.atlas-related {
  margin-top: 1.25rem;
}

.books-page .atlas-hero-stats > span {
  display: inline-flex;
  align-items: baseline;
  gap: .35rem;
  padding: .45rem .7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-bg);
  font-size: .8rem;
}

.books-page .atlas-hero-stats strong {
  color: var(--primary);
  font-size: 1rem;
}

.books-page .atlas-legend {
  width: calc(100% - 6rem);
  max-width: 1155px;
  margin-bottom: 1.25rem;
  margin-right: auto;
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card-bg);
}

.books-page .atlas-legend summary {
  padding: .8rem 1rem;
  color: var(--text-main);
  font-size: .84rem;
  font-weight: 700;
  cursor: pointer;
}

.books-page #atlas-legend-grid {
  padding: 0 1rem 1rem;
}

.books-page .atlas-controls {
  margin-bottom: 2rem;
  box-shadow: 0 4px 14px rgb(25 31 40 / 3%);
}

.books-page .atlas-featured-grid,
.books-page .atlas-grid {
  align-items: stretch;
  grid-auto-rows: 1fr;
}

.books-page .atlas-card {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  overflow: hidden;
  border-top: 3px solid var(--fam, var(--primary));
}

.books-page .atlas-card-top {
  align-items: flex-start;
  min-height: 56px;
}

.books-page .atlas-card-tags {
  min-width: 0;
  margin: 0;
  align-content: flex-start;
}

.books-page .atlas-mark-sigla {
  background: color-mix(in srgb, var(--fam, var(--primary)) 12%, var(--card-bg));
  color: var(--fam, var(--primary));
  font-variant-numeric: tabular-nums;
}

.books-page .atlas-book-card-image,
.books-page .atlas-book-card-fallback {
  display: block;
  width: 100%;
  height: 12rem;
  margin-top: .8rem;
  border-radius: 7px;
  object-fit: cover;
  object-position: center 30%;
}

.books-page .atlas-book-card-fallback {
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--fam, var(--primary)) 12%, var(--card-bg));
  color: var(--fam, var(--primary));
  font-family: "Playfair Display", Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
}

.books-page .atlas-card h3 {
  min-height: 2.5em;
  margin: .8rem 0 .25rem;
  line-height: 1.25;
}

.books-page .atlas-card-sub {
  margin: 0;
  line-height: 1.45;
}

.books-page .atlas-card-summary {
  display: -webkit-box;
  min-height: 4.5em;
  margin: .65rem 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  line-height: 1.5;
}

.books-page .atlas-card-cta {
  margin-top: auto;
  padding-top: .65rem;
}

.books-page .atlas-featured,
.books-page .atlas-section {
  margin-bottom: 3rem;
}

.books-page .atlas-featured-head,
.books-page .section-heading {
  padding-bottom: .85rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.35rem;
  flex-direction: column;
  align-items: start;
}

.books-page .atlas-section-note {
  max-width: 460px;
  margin: 0;
  color: var(--text-muted);
  font-size: .82rem;
  line-height: 1.6;
}

.books-page .atlas-sources {
  margin-bottom: 3.5rem;
  padding: 1.75rem 0 0;
  border-top: 1px solid var(--border);
}

.books-page .atlas-sources h2 {
  margin: .35rem 0 .65rem;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.8rem;
  line-height: 1.2;
}

.books-page .atlas-sources > p {
  max-width: 800px;
  margin: 0;
  color: var(--text-muted);
  font-size: .84rem;
  line-height: 1.7;
}

@media (max-width: 768px) {
  .books-page .atlas-legend {
    width: calc(100% - 2.5rem);
  }

}

/* As capas ficam alinhadas à esquerda como uma estante de leitura. */

.books-page .atlas-featured-grid,
.books-page .atlas-grid {
  grid-template-columns: repeat(auto-fill, minmax(15rem, 18rem));
  justify-content: center;
  align-items: stretch;
  gap: 1.25rem;
}

.books-page .atlas-card {
  position: relative;
  display: flex;
  min-height: 100%;
  flex-direction: column;
  overflow: hidden;
  padding: 1rem;
  border: 1px solid var(--border);
  border-left: 7px solid color-mix(in srgb, var(--fam, var(--primary)) 72%, #111);
  border-radius: 5px 9px 9px 5px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--fam, var(--primary)) 5%, var(--card-bg)), var(--card-bg) 1.2rem);
  box-shadow: 2px 0 0 color-mix(in srgb, var(--border) 55%, transparent), 0 3px 8px rgb(0 0 0 / 8%);
  transform-origin: left center;
  animation: atlas-card-enter 320ms ease-out both;
  transition: border-color 180ms ease, box-shadow 220ms ease, transform 220ms cubic-bezier(.2,.8,.2,1);
}

.books-page .atlas-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: rgb(255 255 255 / 25%);
  content: "";
  pointer-events: none;
}

.books-page .atlas-card:hover,
.books-page .atlas-card:focus-visible {
  border-color: color-mix(in srgb, var(--fam, var(--primary)) 55%, var(--border));
  box-shadow: 5px 8px 18px rgb(0 0 0 / 17%);
  transform: perspective(900px) translateY(-5px) rotateY(-2deg);
}

.books-page .atlas-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.books-page .atlas-book-cover {
  position: relative;
  isolation: isolate;
  display: flex;
  width: min(100%, 15rem);
  aspect-ratio: 3 / 4;
  flex-direction: column;
  justify-content: flex-end;
  align-self: center;
  margin: 0 auto .9rem;
  overflow: hidden;
  padding: 1.1rem .9rem .9rem 1.1rem;
  border-radius: 3px 7px 7px 3px;
  background: color-mix(in srgb, var(--fam, var(--primary)) 30%, #18211f);
  color: #fff;
  box-shadow: 5px 6px 12px rgb(0 0 0 / 25%), inset 1px 0 rgb(255 255 255 / 25%);
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.books-page .atlas-book-cover::before {
  position: absolute;
  z-index: 3;
  inset: 0 auto 0 0;
  width: 10px;
  background: linear-gradient(90deg, rgb(0 0 0 / 30%), rgb(255 255 255 / 18%), transparent);
  content: "";
  pointer-events: none;
}

.books-page .atlas-book-cover::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(180deg, rgb(8 14 13 / 12%) 12%, rgb(8 14 13 / 24%) 40%, rgb(8 14 13 / 88%) 100%);
  content: "";
  pointer-events: none;
}

.books-page .atlas-book-card-image,
.books-page .atlas-book-card-fallback {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 0;
  object-fit: cover;
  object-position: center 28%;
}

.books-page .atlas-book-card-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, color-mix(in srgb, var(--fam, var(--primary)) 55%, #17211f), #18211f 72%);
  color: rgb(255 255 255 / 78%);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 4rem;
  font-weight: 700;
}

.books-page .atlas-book-cover-year,
.books-page .atlas-book-cover-area,
.books-page .atlas-book-cover h3,
.books-page .atlas-book-cover p {
  position: relative;
  z-index: 2;
  color: #fff;
  text-shadow: 0 1px 4px rgb(0 0 0 / 45%);
}

.books-page .atlas-book-cover-year {
  position: absolute;
  top: .7rem;
  right: .7rem;
  padding: .25rem .45rem;
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 3px;
  background: rgb(12 19 18 / 42%);
  font-size: .7rem;
  font-variant-numeric: tabular-nums;
}

.books-page .atlas-book-cover-area {
  align-self: flex-start;
  margin-bottom: .55rem;
  font-size: .63rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.books-page .atlas-book-cover h3 {
  min-height: 0;
  margin: auto 0 .35rem;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.25rem;
  line-height: 1.22;
  text-wrap: pretty;
}

.books-page .atlas-book-cover p {
  margin: 0;
  font-size: .76rem;
  line-height: 1.4;
}

.books-page .atlas-card-tags {
  min-height: 2rem;
  align-content: flex-start;
  margin: .1rem 0 .4rem;
}

.books-page .atlas-card-summary {
  min-height: 6em;
  margin: .45rem 0 .65rem;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  line-height: 1.5;
}

.books-page .atlas-card-cta {
  margin-top: auto;
  padding-top: .6rem;
}

.books-page .atlas-empty {
  grid-column: 1 / -1;
  max-width: 32rem;
}

/* Ficha do livro: capa, contexto editorial e leitura em uma composição só. */

.atlas-dialog-book .atlas-dialog-title .atlas-card-tags {
  gap: .4rem;
  margin: 0;
}

.atlas-dialog-book .atlas-dialog-title .atlas-tag {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--primary);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.atlas-dialog-book .atlas-dialog-title > p {
  line-height: 1.5;
}

.atlas-dialog-book .atlas-dialog-book-cover {
  position: relative;
  isolation: isolate;
  display: flex;
  aspect-ratio: 3 / 4;
  height: auto;
  border-radius: 4px 8px 8px 4px;
  overflow: hidden;
  padding: 1rem .85rem .9rem 1.1rem;
  flex-direction: column;
  justify-content: flex-end;
  color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--fam, var(--primary)) 58%, #18211e), #111714 78%);
  box-shadow: 7px 9px 18px rgb(0 0 0 / 22%), inset 6px 0 rgb(0 0 0 / 30%), inset 8px 0 rgb(255 255 255 / 15%);
}

.atlas-dialog-book .atlas-dialog-book-cover::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(180deg, rgb(8 14 13 / 35%), rgb(8 14 13 / 5%) 36%, rgb(8 14 13 / 92%));
  content: "";
}

.atlas-dialog-book .atlas-dialog-book-image {
  position: absolute;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
}

.atlas-dialog-book .atlas-dialog-cover-area,
.atlas-dialog-book .atlas-dialog-cover-title,
.atlas-dialog-book .atlas-dialog-cover-author {
  position: relative;
  z-index: 1;
  color: #fff;
  text-shadow: 0 1px 5px rgb(0 0 0 / 70%);
}

.atlas-dialog-book .atlas-dialog-cover-area {
  margin-bottom: auto;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.atlas-dialog-book .atlas-dialog-cover-title {
  font: 700 1.1rem/1.2 "Playfair Display", Georgia, serif;
}

.atlas-dialog-book .atlas-dialog-cover-author {
  margin-top: .35rem;
  font-size: .7rem;
}

.atlas-dialog-book .atlas-dialog-book-cover.has-no-image {
  background-image: radial-gradient(ellipse at 75% 15%, color-mix(in srgb, var(--fam, var(--primary)) 38%, transparent), transparent 55%);
}

.atlas-dialog-book .atlas-dialog-close {
  z-index: 4;
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.atlas-dialog-book .atlas-dialog-close:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 9%, var(--card-bg));
}

.atlas-dialog-book .atlas-dialog-section {
  margin: 0;
  padding: 1.25rem 0;
  border-top: 0;
  border-bottom: 1px solid var(--border);
}

.atlas-dialog-book .atlas-dialog-section h3 {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: 0 0 .8rem;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.2rem;
}

.atlas-dialog-book .atlas-dialog-section h3 i {
  color: var(--primary);
  font-size: .95rem;
}

.atlas-dialog-book .atlas-dialog-list {
  gap: .5rem;
  list-style: none;
}

.atlas-dialog-book .atlas-dialog-list li {
  color: var(--text-muted);
  font-size: .88rem;
  line-height: 1.6;
}

.atlas-dialog-book .atlas-dialog-body a {
  color: var(--primary);
  text-decoration-color: color-mix(in srgb, var(--primary) 45%, transparent);
  text-underline-offset: .16em;
}

.atlas-dialog-book .atlas-dialog-body a:hover {
  text-decoration-color: currentColor;
}

.atlas-dialog-book .atlas-dialog-summary {
  margin: .9rem 0 0;
  color: var(--text-main);
  line-height: 1.7;
}

.atlas-dialog-book .atlas-dialog-label {
  margin: 1.25rem 0 .55rem;
  color: var(--text-main);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.atlas-dialog-book .atlas-related {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0;
}

.atlas-dialog-book .atlas-related a {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 36px;
  padding: .4rem .75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-bg);
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
}

.atlas-dialog-book .atlas-related a:hover {
  border-color: var(--primary);
}

.atlas-dialog-book .atlas-dialog-footer {
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem 1.5rem;
  background: var(--card-bg);
}

.atlas-dialog-book .atlas-dialog-footer p {
  max-width: 38rem;
  margin: 0;
  color: var(--text-muted);
  font-size: .78rem;
  line-height: 1.55;
}

.atlas-dialog-book .atlas-readmore {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: .45rem;
  min-height: 40px;
  padding: .55rem .8rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--primary);
  font-size: .8rem;
  font-weight: 700;
  text-decoration: none;
}

.atlas-dialog-book .atlas-readmore:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 7%, var(--card-bg));
}

@keyframes atlas-book-dialog-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 768px) {
  .books-page .atlas-featured-grid,
  .books-page .atlas-grid {
    grid-template-columns: repeat(auto-fill, minmax(14rem, 18rem));
    justify-content: center;
  }

  .atlas-dialog-book .atlas-dialog-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 1rem 0 0;
  }
}

@media (max-width: 520px) {
  .books-page .atlas-featured-grid,
  .books-page .atlas-grid {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
  }

  .books-page .atlas-card {
    max-width: 22rem;
  }
}

.books-page .atlas-card {
  transition: transform 240ms cubic-bezier(.2, .75, .25, 1), border-color 200ms ease, box-shadow 240ms ease;
}

.books-page .atlas-card:hover,
.books-page .atlas-card:focus-visible {
  box-shadow: 0 16px 30px rgb(0 0 0 / 22%);
  transform: translateY(-7px);
}

.books-page .atlas-card:hover .atlas-book-cover,
.books-page .atlas-card:focus-visible .atlas-book-cover {
  box-shadow: 8px 12px 22px rgb(0 0 0 / 32%), inset 1px 0 rgb(255 255 255 / 25%);
  transform: perspective(700px) rotateY(-3deg) scale(1.025);
}

.books-page .atlas-card-cta {
  justify-content: center;
  min-height: 2.6rem;
  padding: .6rem .8rem;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.books-page .atlas-card:hover .atlas-card-cta,
.books-page .atlas-card:focus-visible .atlas-card-cta {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .books-page .atlas-card,
  .books-page .atlas-book-cover,
  .atlas-dialog-book .atlas-dialog-close {
    animation: none;
    transition: none;
  }
}

/* Usa o overlay, backdrop e painel de detalhes da página História. */

.books-page main > section.books-detail {
  width: auto;
  max-width: none;
  margin: 0;
}

.atlas-dialog-book .atlas-dialog-shell {
  max-height: none;
  overflow: visible;
  background: transparent;
}

.atlas-dialog-book .atlas-dialog-head {
  position: sticky;
  top: -2rem;
  z-index: 3;
  display: flex;
  min-height: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin: -2rem -2rem 1.25rem;
  padding: 2rem 2rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg) !important;
}

.atlas-dialog-book .atlas-dialog-head > .atlas-mark {
  display: none;
}

.atlas-dialog-book .atlas-dialog-title {
  min-width: 0;
}

.atlas-dialog-book .atlas-dialog-title h2 {
  margin: .35rem 0;
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  line-height: 1.15;
}

.atlas-dialog-book .atlas-dialog-title > p {
  margin: 0;
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 700;
}

.atlas-dialog-book .atlas-dialog-close {
  position: relative;
  top: auto;
  right: auto;
  width: var(--kn-modal-close-size);
  height: var(--kn-modal-close-size);
  flex: 0 0 auto;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
}

.atlas-dialog-book .atlas-dialog-close:hover,
.atlas-dialog-book .atlas-dialog-close:focus-visible {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, transparent);
  transform: none;
}

.atlas-dialog-book .atlas-dialog-body {
  padding: 0;
}

.atlas-dialog-book .atlas-dialog-book-cover {
  width: min(100%, 190px);
  margin: 0 0 1.25rem;
}

@media (max-width: 768px) {
  .atlas-dialog-book .atlas-dialog-head {
    top: -1.25rem;
    margin: -1.25rem -1.25rem 1rem;
    padding: 1.25rem 1.25rem 1rem;
  }

  .atlas-dialog-book .atlas-dialog-book-cover {
    width: min(58vw, 13rem);
    justify-self: start;
  }

  .atlas-dialog-book .atlas-dialog-title,
  .atlas-dialog-book .atlas-dialog-title h2 {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 520px) {
  .atlas-dialog-book .atlas-dialog-head {
    top: -1rem;
    margin: -1rem -1rem 1rem;
    padding: 1rem 1rem .9rem;
  }
}

@media (max-width: 768px) {
  /* LIVROS · duas colunas em telas pequenas */

  .books-page .atlas-featured-grid,
  .books-page .atlas-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    justify-items: stretch;
    gap: .75rem;
  }

  .books-page .atlas-card {
    gap: .75rem;
    min-height: 0;
    padding: .75rem;
    border-radius: 10px;
  }

  .books-page .atlas-featured-grid,
  .books-page .atlas-grid {
    grid-auto-rows: auto;
  }

  .books-page .atlas-card-tags,
  .books-page .atlas-card-summary,
  .books-page .atlas-card .atlas-fp {
    display: none;
  }

  .books-page .atlas-book-cover {
    box-sizing: border-box;
    width: 100%;
    margin-bottom: 0;
  }

  .books-page .atlas-book-cover h3 {
    display: -webkit-box;
    overflow: hidden;
    font-size: 1.05rem;
    overflow-wrap: anywhere;
    hyphens: auto;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  .books-page .atlas-book-cover-area,
  .books-page .atlas-book-cover p {
    display: none;
  }

  .books-page .atlas-card-cta {
    box-sizing: border-box;
    width: 100%;
    min-height: 2.3rem;
    margin-top: 0;
    padding: .45rem .6rem;
    font-size: .74rem;
  }
}

/* FICHA DO LIVRO · subtítulos discretos */

.atlas-dialog-book .atlas-dialog-title > p,
.atlas-dialog-book .atlas-dialog-summary {
  color: var(--text-muted);
}

/* ORDENAÇÃO · controle customizado */

.books-page .atlas-sort {
  position: relative;
  display: block;
  min-width: 0;
}

.books-page .atlas-sort-trigger {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: .5rem;
  padding: 0 .85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-main);
  font: inherit;
  font-size: .8rem;
  white-space: nowrap;
  cursor: pointer;
}

.books-page .atlas-sort-trigger:hover,
.books-page .atlas-sort[data-open="true"] .atlas-sort-trigger {
  border-color: var(--primary);
  color: var(--primary);
}

.books-page .atlas-sort-label {
  color: var(--text-muted);
}

.books-page .atlas-sort-value {
  font-weight: 700;
}

.books-page .atlas-sort-chevron {
  color: var(--text-muted);
  font-size: .7rem;
  transition: transform 180ms ease;
}

.books-page .atlas-sort[data-open="true"] .atlas-sort-chevron {
  transform: rotate(180deg);
}

.books-page .atlas-sort-menu {
  position: absolute;
  top: calc(100% + .4rem);
  right: 0;
  left: auto;
  z-index: 20;
  display: grid;
  width: max-content;
  min-width: 15rem;
  max-width: min(20rem, calc(100vw - 2.5rem));
  margin: 0;
  padding: .35rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card-bg);
  box-shadow: 0 12px 28px rgb(24 37 34 / 16%);
  list-style: none;
}

.books-page .atlas-sort-menu[hidden] {
  display: none;
}

.books-page .atlas-sort-option {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .55rem .6rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-main);
  font: inherit;
  font-size: .78rem;
  text-align: left;
  cursor: pointer;
}

.books-page .atlas-sort-option i {
  color: var(--primary);
  font-size: .72rem;
  opacity: 0;
}

.books-page .atlas-sort-option:hover,
.books-page .atlas-sort-option:focus-visible {
  background: color-mix(in srgb, var(--primary) 8%, var(--card-bg));
  color: var(--primary);
  outline: none;
}

.books-page .atlas-sort-option[aria-selected="true"] {
  color: var(--primary);
  font-weight: 700;
}

.books-page .atlas-sort-option[aria-selected="true"] i {
  opacity: 1;
}

.books-page .atlas-filter-accordion .atlas-clear {
  align-self: center;
  height: 34px;
  min-height: 34px;
  padding: .4rem .7rem;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
}

.books-page .atlas-filter-accordion .atlas-clear:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* CONTROLES MOBILE · filtros, pesquisa e ordenação na mesma barra */

.books-page .atlas-controls-shell {
  display: contents;
}

@media (max-width: 768px) {
  .books-page .atlas-controls-shell {
    position: sticky;
    top: 4.75rem;
    z-index: 10;
    display: grid;
    grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;
    align-items: center;
    gap: .5rem;
    margin: 0 1.25rem .65rem;
    padding: .55rem 0;
    background: var(--bg-container);
  }

  .books-page .atlas-search-dock {
    position: static;
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    padding: 0;
  }

  .books-page .atlas-controls {
    display: contents;
  }

  .books-page .atlas-filter-accordion,
  .books-page .atlas-sort {
    grid-row: 1;
  }

  .books-page .atlas-filter-accordion {
    grid-column: 1;
    overflow: visible;
    border: 0;
    background: transparent;
  }
  /* Botão Filtros mobile — mesmo estilo da barra de pesquisa */

  .books-page .atlas-filter-accordion > summary {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-container);
    color: var(--text-main);
    cursor: pointer;
    list-style: none;
    transition: border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
  }

  .books-page .atlas-filter-accordion > summary:hover {
    border-color: var(--primary);
    color: var(--primary);
  }

  .books-page .atlas-filter-accordion > summary:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 10%, transparent);
  }

  .books-page .atlas-filter-accordion > summary span {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .books-page .atlas-filter-accordion > summary span i {
    color: var(--primary);
    font-size: 1rem;
    transition: color 180ms ease;
  }

  .books-page .atlas-filter-accordion > summary:hover span i,
  .books-page .atlas-filter-accordion > summary:focus-visible span i {
    color: var(--primary);
  }

  .books-page .atlas-filter-accordion > summary span b,
  .books-page .atlas-filter-accordion > summary > .atlas-filter-chevron {
    display: none;
  }

  .books-page .atlas-filter-accordion[open] > summary {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-container);
  }

  .books-page .atlas-filter-accordion .atlas-filters {
    position: absolute;
    top: calc(100% + .4rem);
    left: 0;
    right: 0;
    z-index: 2;
    max-height: min(60vh, 26rem);
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--card-bg);
    box-shadow: 0 12px 28px rgb(24 37 34 / 16%);
    /* Alinhado ao botão e com a mesma margem lateral da página, sem as larguras de atlas.css. */
    right: auto;
    width: calc(100vw - 2.5rem);
    min-width: 0;
    max-width: none;
    margin: 0;
  }
  /* Botão Ordenar mobile — mesmo estilo da barra de pesquisa */

  .books-page .atlas-sort {
    grid-column: 3;
    width: 2.75rem;
    height: 2.75rem;
  }

  .books-page .atlas-sort-trigger {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    min-height: 0;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-container);
    color: var(--primary);
    font-size: 1rem;
    transition: border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
  }

  .books-page .atlas-sort-trigger:hover {
    border-color: var(--primary);
    color: var(--primary);
  }

  .books-page .atlas-sort-trigger:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 10%, transparent);
  }

  .books-page .atlas-sort[data-open="true"] .atlas-sort-trigger {
    border-color: var(--primary);
    color: var(--primary);
  }

  .books-page .atlas-sort-label,
  .books-page .atlas-sort-value {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .books-page .atlas-sort-chevron {
    display: none;
  }

  .books-page .atlas-sort-menu {
    right: 0;
    width: min(15rem, calc(100vw - 2.5rem));
  }
}

/* Pesquisa — estilo inspirado na página História, mas com tamanho próprio */

.books-page .atlas-search-dock {
  position: sticky;
  top: 5.5rem;
  z-index: 10;
  margin: 0 3rem .75rem;
  padding: .65rem 0;
  background: var(--bg-container);
}

.books-page .atlas-search-dock .atlas-search {
  position: relative;
}

.books-page .atlas-search-dock .atlas-search i {
  position: absolute;
  top: 50%;
  left: .9rem;
  color: var(--text-muted);
  transform: translateY(-50%);
  pointer-events: none;
  font-size: .85rem;
  transition: color 180ms ease;
}

.books-page .atlas-search-dock .atlas-search input {
  width: 100%;
  padding: .68rem .9rem .68rem 2.4rem;
  border-radius: 8px;
  outline: none;
  background: var(--bg-container);
  color: var(--text-main);
  font: inherit;
  font-size: .82rem;
  box-sizing: border-box;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.books-page .atlas-search-dock .atlas-search input:focus + i,
.books-page .atlas-search-dock .atlas-search:focus-within i {
  color: var(--primary);
}

@media (max-width: 768px) {
  .books-page .atlas-search-dock .atlas-search {
    width: 100%;
  }
}

.books-page .atlas-filter-accordion {
  min-width: 0;
}

.books-page .atlas-filter-accordion > summary {
  display: none;
}

.books-page .atlas-filter-chevron {
  transition: transform 180ms ease;
}

.books-page .atlas-filter-accordion[open] .atlas-filter-chevron {
  transform: rotate(180deg);
}

@media (max-width: 768px) {
  .books-page .atlas-search-dock {
    top: 4.75rem;
    margin: 0 1.25rem .65rem;
    padding: .55rem 0;
  }

  .books-page .atlas-controls {
    gap: .65rem;
  }

  .books-page .atlas-filter-accordion {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--card-bg);
  }

  .books-page .atlas-filter-accordion > summary {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .7rem .85rem;
    color: var(--text-main);
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
  }

  .books-page .atlas-filter-accordion > summary::-webkit-details-marker {
    display: none;
  }

  .books-page .atlas-filter-accordion > summary span {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
  }

  .books-page .atlas-filter-accordion > summary span i {
    color: var(--primary);
  }

  .books-page .atlas-filter-accordion[open] > summary {
    border-bottom: 1px solid var(--border);
  }

  .books-page .atlas-filter-accordion .atlas-filters {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: .85rem;
    padding: .85rem;
  }

  .books-page .atlas-filter-accordion .atlas-filter-group {
    align-items: flex-start;
    flex-direction: column;
    gap: .45rem;
  }

  .books-page .atlas-filter-accordion .atlas-chips-row {
    gap: .4rem;
  }

  .books-page .atlas-filter-accordion .atlas-chip,
  .books-page .atlas-filter-accordion .atlas-clear {
    min-height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .books-page .atlas-filter-chevron {
    transition: none;
  }
}

@media (max-width: 768px) {
  .books-page .atlas-search-dock {
    position: static;
    top: auto;
    margin: 0;
    padding: 0;
  }

  .books-page .atlas-filter-accordion {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .books-page .atlas-filter-accordion > summary {
    width: 2.75rem;
    height: 2.75rem;
    min-height: 0;
    justify-content: center;
    padding: 0;
  }
}

@media (min-width: 769px) {
  /* CONTROLES DESKTOP · pesquisa, filtros e ordenação na mesma barra */

  .books-page .atlas-controls-shell {
    position: sticky;
    top: 5.5rem;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: 0 3rem .75rem;
    padding: .65rem 0;
    background: var(--bg-container);
  }

  .books-page .atlas-search-dock {
    position: static;
    top: auto;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    background: transparent;
  }

  .books-page .atlas-controls {
    display: contents;
  }

  .books-page details#atlas-filter-accordion {
    position: static;
    flex: none;
    min-width: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  /* Botão Filtros — mesmo estilo da barra de pesquisa */

  .books-page details#atlas-filter-accordion > summary {
    display: flex;
    height: 42px;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 0 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-container);
    color: var(--text-main);
    font-size: .8rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    list-style: none;
    transition: border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
  }

  .books-page details#atlas-filter-accordion > summary:hover {
    border-color: var(--primary);
    color: var(--primary);
  }

  .books-page details#atlas-filter-accordion > summary:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 10%, transparent);
  }

  .books-page details#atlas-filter-accordion > summary::-webkit-details-marker {
    display: none;
  }

  .books-page details#atlas-filter-accordion > summary span {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
  }

  .books-page details#atlas-filter-accordion > summary span i {
    color: var(--primary);
    transition: color 180ms ease;
  }

  .books-page details#atlas-filter-accordion > summary:hover span i,
  .books-page details#atlas-filter-accordion > summary:focus-visible span i {
    color: var(--primary);
  }

  .books-page details#atlas-filter-accordion[open] > summary {
    border-color: var(--primary);
    background: var(--bg-container);
    color: var(--primary);
  }

  .books-page .atlas-filter-accordion .atlas-filters {
    position: absolute;
    top: calc(100% + .4rem);
    right: 0;
    left: 0;
    z-index: 2;
    max-height: min(60vh, 26rem);
    margin: 0;
    padding: .85rem;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--card-bg);
    box-shadow: 0 12px 28px rgb(24 37 34 / 16%);
  }
  /* Botão Ordenar — mesmo estilo da barra de pesquisa */

  .books-page .atlas-sort {
    flex: none;
  }

  .books-page .atlas-sort-trigger {
    height: 42px;
    min-height: 42px;
    padding: 0 1rem 0 .9rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-container);
    color: var(--text-main);
    font-size: .8rem;
    transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease, color 180ms ease;
  }

  .books-page .atlas-sort-trigger:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-container);
  }

  .books-page .atlas-sort-trigger:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 10%, transparent);
  }

  .books-page .atlas-sort[data-open="true"] .atlas-sort-trigger {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-container);
  }

  .books-page .atlas-sort-label {
    font-weight: 600;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    transition: color 180ms ease;
  }

  .books-page .atlas-sort-trigger:hover .atlas-sort-label,
  .books-page .atlas-sort[data-open="true"] .atlas-sort-label {
    color: var(--primary);
  }

  .books-page .atlas-sort-value {
    font-weight: 600;
    font-size: .8rem;
  }

  .books-page .atlas-sort-chevron {
    color: var(--text-muted);
    font-size: .65rem;
    transition: transform 200ms cubic-bezier(.2,.8,.2,1), color 180ms ease;
  }

  .books-page .atlas-sort-trigger:hover .atlas-sort-chevron,
  .books-page .atlas-sort[data-open="true"] .atlas-sort-chevron {
    color: var(--primary);
  }

  .books-page .atlas-sort[data-open="true"] .atlas-sort-chevron {
    transform: rotate(180deg);
  }
}

/* Livros segue a leitura em coluna das páginas editoriais. */

.books-page main > section:not(.page-hero, .detail-panel) {
  width: auto;
  max-width: none;
  margin-right: 3rem;
  margin-left: 3rem;
}

.books-page .atlas-hero {
  max-width: 860px;
  padding: 4rem 3rem 2.5rem;
}

@media (max-width: 768px) {
  .books-page main > section:not(.page-hero, .detail-panel) {
    margin-right: 1.25rem;
    margin-left: 1.25rem;
  }

  .books-page .atlas-hero {
    padding: 2rem 1.25rem 1.4rem;
  }
}
