/* livros.css — página /livros ("Nossa estante"): topo lima de loja, filtros numa régua fina,
   e a grade de quadrados com respiro; o quadrado escolhido vira lima com título, sinopse, preço e "ver livro". */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* topo lima: só o logo, o sol/lua e o carrinho */
.grade-topo { display: flex; align-items: center; gap: 8px; padding: 12px var(--margem); background: var(--lima); color: var(--preto); }
.grade-marca { margin-right: auto; display: block; }
.grade-marca img { display: block; width: auto; height: 34px; filter: none; } /* só o S da Seiva */
.grade-topo .tema, .grade-carrinho { color: var(--preto); }
.grade-topo .tema:hover, .grade-carrinho:hover { background: rgba(0, 0, 0, .08); }
.grade-carrinho { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; }
.grade-carrinho svg { width: 24px; height: 24px; }

/* o título gigante, de ponta a ponta (como o "MUSEUM" da referência) */
.grade-titulo { margin: 0; padding: clamp(8px, 1.2vw, 18px) var(--margem) clamp(4px, .6vw, 10px); border-bottom: 1px solid var(--linha);
  font-weight: 700; font-size: clamp(44px, 11.4vw, 210px); line-height: .86; letter-spacing: -.035em; text-transform: uppercase; white-space: nowrap; }
@media (max-width: 720px) { .grade-titulo { white-space: normal; font-size: 19vw; } }

/* régua de filtros */
.grade-filtros { display: grid; grid-template-columns: 1fr 1fr 1fr; border-bottom: 1px solid var(--linha); font-size: 14px; text-transform: uppercase; }
.grade-filtros > * { margin: 0; padding: 8px var(--margem); border-right: 1px solid var(--linha); display: flex; align-items: center; gap: 8px; }
.grade-filtros > *:last-child { border-right: 0; }
.grade-filtros select { flex: 1; min-width: 0; min-height: 32px; background: transparent; color: inherit; border: 0; font: inherit; text-transform: uppercase; cursor: pointer; }
.grade-conta { color: var(--cinza); }

/* a grade */
.pagina-grade main { padding: 14px var(--margem) 0; }
.grade { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.grade-item { position: relative; aspect-ratio: 1; background: #e4e4e1; }
[data-tema="claro"] .grade-item { background: #e4e4e1; }
:root:not([data-tema="claro"]) .grade-item { background: #1c1c1c; }

/* fechado: só a capa no meio */
.grade-capa { position: absolute; inset: 0; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.grade-capa img { max-width: 50%; max-height: 64%; width: auto; height: auto; box-shadow: 4px 6px 14px rgba(0, 0, 0, .28); transition: transform .25s; }
.grade-capa:hover img { transform: translateY(-4px); }

/* aberto: o quadrado vira lima */
.grade-aberto { position: absolute; inset: 0; background: var(--lima); color: var(--preto); padding: clamp(14px, 1.6vw, 22px); display: flex; flex-direction: column; overflow: hidden; }
.grade-aberto h2 { margin: 0; font-weight: 700; font-size: clamp(22px, 2.3vw, 34px); line-height: .95; letter-spacing: -.02em; text-transform: uppercase; }
.grade-aberto .autores { margin: 6px 0 0; font: 400 clamp(14px, 1.1vw, 17px)/1.25 var(--serif); }
.grade-aberto .sinopse { margin: 10px 0 0; font-size: clamp(13px, 1vw, 15px); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.grade-aberto .pe { margin-top: auto; padding-top: 10px; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.grade-aberto .preco { font-weight: 700; font-size: clamp(24px, 2.4vw, 36px); letter-spacing: -.02em; line-height: 1; }
.grade-aberto .acoes { display: flex; align-items: center; gap: 8px; }
.grade-aberto .comprar { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px; background: var(--preto); color: var(--lima); text-decoration: none; font-weight: 500; font-size: 14px; text-transform: uppercase; }
.grade-aberto .comprar:hover { background: #222; }
.grade-aberto .mais { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--preto); color: var(--preto); text-decoration: none; font-size: 24px; line-height: 1; font-weight: 400; }
.grade-aberto .mais:hover { background: var(--preto); color: var(--lima); }
.grade-aberto .fechar { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--preto); font-size: 18px; cursor: pointer; }
.grade-aberto .fechar:hover { background: rgba(0, 0, 0, .08); }

@media (max-width: 1100px) { .grade { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .grade-filtros { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .grade-aberto .pe { flex-wrap: wrap; align-items: center; }
  .grade-aberto .preco { font-size: 24px; }
  .grade-conta { display: none; }
  .grade { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  /* no celular o escolhido ocupa a linha toda, para o texto caber */
  .grade-item.aberto { grid-column: 1 / -1; aspect-ratio: auto; min-height: 320px; }
}
@media (max-width: 420px) {
  .grade-filtros { grid-template-columns: 1fr; }
  .grade-filtros > * { border-right: 0; border-bottom: 1px solid var(--linha); }
  .grade-filtros > *:last-child { border-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) { .grade-capa img { transition: none; } }
.pagina-grade .rodape { margin-top: clamp(56px, 8vw, 110px); }

/* página de um livro (livros/livro/#slug): setinha de voltar, capa grande à esquerda, texto à direita */
.livro-pagina { padding: clamp(18px, 2.4vw, 32px) var(--margem) 0; }
.livro-voltar { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; font-size: 15px; text-transform: uppercase; text-decoration: none; color: inherit; }
.livro-voltar span { font-size: 26px; line-height: 1; transition: transform .2s; }
.livro-voltar:hover span { transform: translateX(-4px); }
.livro-ficha-pagina { margin-top: clamp(20px, 3vw, 40px); display: flex; flex-wrap: wrap; gap: 40px clamp(40px, 6vw, 96px); align-items: flex-start; }
.livro-capa-grande { flex: 1 1 300px; display: flex; justify-content: center; align-items: center; padding: clamp(28px, 4vw, 56px); background: #e4e4e1; aspect-ratio: 1; }
:root:not([data-tema="claro"]) .livro-capa-grande { background: #1c1c1c; }
/* a capa na proporção do livro; os maiores (16 × 23 cm) ocupam a caixa, os menores ficam menores */
.livro-capa-grande img { width: calc(var(--l) / 24 * 100%); height: auto; max-height: 100%; aspect-ratio: var(--l) / var(--a); object-fit: cover; box-shadow: 8px 12px 28px rgba(0, 0, 0, .3); }
.livro-texto { flex: 999 1 420px; min-width: 0; max-width: 680px; }
.livro-texto .livro-rotulo { margin: 0; font-weight: 500; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.livro-nome { margin: 10px 0 0; font-weight: 700; font-size: clamp(40px, 5vw, 76px); line-height: .92; letter-spacing: -.02em; text-transform: uppercase; }
.livro-quem { margin: 12px 0 0; font: 400 24px/1.3 var(--serif); color: var(--cinza); }
.livro-intro { margin-top: 26px; }
.livro-intro p { margin: 0 0 14px; font-size: 18px; line-height: 1.55; }
.livro-tamanho { margin: 8px 0 0; font-size: 14px; color: var(--cinza); }
.livro-texto .livro-compra { margin-top: 26px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.livro-texto .livro-preco { font-weight: 700; font-size: 34px; letter-spacing: -.02em; }
.livro-texto .livro-comprar { display: inline-flex; align-items: center; min-height: 50px; padding: 0 26px; border-radius: 999px; background: var(--lima); color: var(--preto); text-decoration: none; font-weight: 500; text-transform: uppercase; font-size: 15px; }
[data-tema="claro"] .livro-texto .livro-comprar { background: var(--preto); color: var(--lima); }
.livro-nao-achado { font-size: 18px; }
/* quando no lugar do preço vem um selo ("20% off na pré-venda"), letra menor para caber numa linha */
.grade-aberto .preco.texto { font-size: clamp(15px, 1.2vw, 19px); line-height: 1.15; letter-spacing: 0; }
/* o preço acompanha a largura do quadrado (R$ 149,90 não empurra o +) e, se ainda não couber, os botões descem */
.grade-aberto { container-type: inline-size; }
.grade-aberto .pe { flex-wrap: wrap; align-items: center; row-gap: 10px; }
.grade-aberto .preco { font-size: clamp(20px, 8cqi, 36px); white-space: nowrap; }
.grade-aberto .acoes { flex-shrink: 0; }
/* preço com selo (ex.: pré-venda): o selo vem pequeno embaixo do preço */
.grade-aberto .preco small { display: block; margin-top: 4px; font-size: 13px; font-weight: 500; letter-spacing: 0; white-space: normal; }

/* v3 do quadrado: fechado mostra preço + "adicionar à sacola" embaixo; aberto mostra título, autores, uma frase e o + */
.grade-rodape { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; }
.grade-valor { font-weight: 500; font-size: 15px; }
.grade-sacola { display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border-radius: 999px; background: var(--preto); color: var(--lima); text-decoration: none; font-weight: 500; font-size: 12px; text-transform: uppercase; white-space: nowrap; }
.grade-sacola:hover { background: var(--lima); color: var(--preto); }
:root:not([data-tema="claro"]) .grade-sacola { background: var(--lima); color: var(--preto); }
:root:not([data-tema="claro"]) .grade-sacola:hover { background: #fff; }
.grade-capa { bottom: 54px; }
.grade-capa img { max-height: 76%; max-width: 54%; }
.grade-aberto .frase { margin: 14px 0 0; font-size: clamp(15px, 1.25vw, 19px); line-height: 1.35; }
.grade-aberto .mais { position: absolute; right: clamp(14px, 1.6vw, 22px); bottom: clamp(14px, 1.6vw, 22px); width: 48px; height: 48px; font-size: 28px; }
@media (max-width: 720px) {
  /* no celular: preço em cima, botão embaixo ocupando a largura */
  .grade-rodape { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px; }
  .grade-valor { font-size: 13px; }
  .grade-sacola { justify-content: center; min-height: 32px; padding: 0 8px; font-size: 11px; }
  .grade-capa { bottom: 76px; }
  .grade-item { aspect-ratio: 3 / 4; }
  .grade-item.aberto { min-height: 240px; }
}

/* etiqueta contínua: uma faixa na largura inteira do quadrado, com o preço à esquerda e "comprar →" à direita; a faixa toda é o link */
.grade-etiqueta { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 46px; padding: 0 14px; background: var(--preto); color: var(--lima); text-decoration: none; font-weight: 500; font-size: 15px; text-transform: uppercase; transition: background .2s, color .2s; }
.grade-etiqueta span:first-child { text-transform: none; }
a.grade-etiqueta:hover { background: var(--lima); color: var(--preto); }
:root:not([data-tema="claro"]) .grade-etiqueta { background: var(--lima); color: var(--preto); }
:root:not([data-tema="claro"]) a.grade-etiqueta:hover { background: #fff; }
/* "em breve" na mesma etiqueta dos outros (sem link) */
.grade-etiqueta.vazia span:first-child { text-transform: uppercase; }
.grade-capa { bottom: 46px; }
@media (max-width: 720px) {
  .grade-item { aspect-ratio: 4 / 5; }
  .grade-capa { bottom: 40px; }
  .grade-etiqueta { min-height: 40px; padding: 0 10px; font-size: 12px; }
}
.grade-etiqueta span { white-space: nowrap; }
.grade-etiqueta b { font-weight: inherit; }
.grade-etiqueta .curto { display: none; }
@media (max-width: 720px) { .grade-etiqueta .longo { display: none; } .grade-etiqueta .curto { display: inline; } }

/* título centralizado */
.grade-titulo { text-align: center; }
