/* ==========================================================================
   AZURE — peças das páginas do sistema (livros e criador de ficha)
   Carregado DEPOIS do estilo.css: usa as mesmas cores e só acrescenta.
   As famílias de caixa seguem os livros: ouro marca regra, azul marca
   exemplo, vinho marca perigo e magia, verde marca talento e variante.
   Índice: 1 cor extra · 2 livro · 3 caixas · 4 tabelas · 5 criaturas
           6 sumário · 7 vitrine · 8 ficha · 9 impressão
   ========================================================================== */

/* --- 1. Uma cor a mais: o vinho dos livros ------------------------------ */
:root { --vinho: #EAA0AA; --vinho-fundo: rgba(234, 160, 170, 0.07); --pergaminho: #F7F2E7; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --vinho: #8A2233; --vinho-fundo: rgba(138, 34, 51, 0.05); }
}
:root[data-theme="light"] { --vinho: #8A2233; --vinho-fundo: rgba(138, 34, 51, 0.05); }

/* --- 2. O texto do livro ------------------------------------------------- */
.livro { max-width: 46rem; padding-bottom: 3rem; }
.livro > p, .livro li { max-width: var(--medida); }
.livro p + p { margin-top: 0.85rem; }
.livro > p, .livro > ul, .livro > ol, .livro > dl { margin-top: 0.85rem; }
.livro ul, .livro ol { padding-left: 1.3rem; }
.livro li + li { margin-top: 0.3rem; }
.livro li > p { margin: 0; }
.livro dt { font-weight: 600; margin-top: 0.6rem; }
.livro dd { margin: 0.1rem 0 0 1.3rem; color: var(--fosco); }

.livro h1 {
  font-size: var(--t-4);
  margin: 3.5rem 0 0.5rem;
  padding: 1.6rem 0 0.4rem;
  border-top: 3px double var(--ouro);
  scroll-margin-top: 1rem;
}
.livro h1::before {
  content: "Parte";
  display: block;
  font-family: var(--ui);
  font-size: var(--t--2);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ouro);
  margin-bottom: 0.6rem;
}
.livro h2 {
  font-size: var(--t-3);
  margin: 2.6rem 0 0.9rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--linha);
  scroll-margin-top: 1rem;
}
.livro h1 + h2 { border-top: 0; margin-top: 1.2rem; }
.livro h3 { font-size: var(--t-2); margin: 2rem 0 0.6rem; color: var(--azul); scroll-margin-top: 1rem; }
.livro h4 { font-size: var(--t-1); margin: 1.5rem 0 0.4rem; scroll-margin-top: 1rem; }
.livro h5 { font-family: var(--ui); font-size: var(--t--1); font-weight: 700; margin: 1rem 0 0.3rem; }

.dado { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--vinho); white-space: nowrap; }
.pa   { font-weight: 700; color: var(--vinho); white-space: nowrap; }
.reacao { font-weight: 700; color: var(--azul); }
.cond { font-weight: 600; color: var(--azul); }
.traco { color: var(--verde); }
.ef { color: var(--azul); }
.cr { color: var(--vinho); }
.rotulo-fosco { color: var(--fosco); }
.linha-branca { display: inline-block; min-width: 7rem; border-bottom: 1px solid var(--linha-2); margin: 0 0.25rem; }

.livro blockquote {
  margin: 1.2rem 0;
  padding: 0.6rem 1.1rem;
  border-left: 3px solid var(--ouro);
  font-family: var(--serifada);
  font-style: italic;
  font-size: var(--t-1);
}

/* Pranchas e diagramas */
.prancha, .diagrama { margin: 1.8rem 0; }
.prancha img { display: block; width: 100%; height: auto; border-radius: var(--raio-p); border: 1px solid var(--linha); }
.prancha figcaption {
  margin-top: 0.55rem;
  font-size: var(--t--2);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fosco);
}
.diagrama img { display: block; width: 100%; max-width: 36rem; height: auto; background: var(--pergaminho); border-radius: var(--raio-p); padding: 0.6rem; }

/* --- 3. Caixas ------------------------------------------------------------ */
.regra, .regralarga, .exemplo, .alerta, .talento, .magia, .variante, .itemmagico, .fichalink {
  --cor: var(--ouro);
  --fundo-caixa: var(--painel);
  margin: 1.3rem 0;
  padding: 0 1.15rem 1rem;
  background: var(--fundo-caixa);
  border: 1px solid var(--linha);
  border-left: 3px solid var(--cor);
  border-radius: var(--raio-p);
  font-size: 0.97rem;
  line-height: 1.6;
  overflow: hidden;
}
.exemplo   { --cor: var(--azul); font-style: italic; }
.exemplo .caixa-titulo { font-style: normal; }
.alerta    { --cor: var(--vinho); --fundo-caixa: var(--vinho-fundo); }
.talento, .variante { --cor: var(--verde); }
.magia     { --cor: var(--vinho); }
.itemmagico { --cor: var(--ouro); border-top: 2px solid var(--azul); border-bottom: 2px solid var(--azul); }
.talento, .magia { margin: 0.75rem 0; }

.caixa-titulo {
  margin: 0 -1.15rem 0.75rem;
  padding: 0.6rem 1.15rem;
  background: var(--painel-2);
  border-bottom: 1px solid var(--linha);
  font-family: var(--ui);
  font-size: var(--t--2);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cor);
}
.itemmagico > .caixa-titulo, .criatura > .caixa-titulo {
  font-family: var(--serifada);
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--texto);
}
.regra p + p, .alerta p + p { margin-top: 0.5rem; }
.regra ul, .alerta ul, .exemplo ul { margin: 0.4rem 0; }
.fichalink { --cor: var(--azul); padding-top: 1rem; }
.fichalink a { color: var(--azul); font-weight: 600; }

/* --- 4. Tabelas ----------------------------------------------------------- */
.tabela { margin: 1.3rem 0; overflow-x: auto; border: 1px solid var(--linha); border-radius: var(--raio-p); background: var(--painel); }
.tabela table { border-collapse: collapse; width: 100%; font-size: 0.9rem; line-height: 1.45; }
.tabela th {
  text-align: left !important;
  font-family: var(--ui);
  font-size: var(--t--2);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--azul);
  background: var(--painel-2);
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--ouro);
  white-space: nowrap;
}
.tabela td { padding: 0.5rem 0.75rem; vertical-align: top; border-top: 1px solid var(--linha); text-align: left !important; }
.tabela tr:first-child td { border-top: 0; }
.tabela td:first-child { font-weight: 600; }
.tabela tbody tr:hover { background: var(--painel-2); }

/* --- 5. Criaturas --------------------------------------------------------- */
.criatura {
  margin: 1.8rem 0;
  padding: 0 1.25rem 1.1rem;
  background: var(--painel);
  border: 1px solid var(--linha);
  border-top: 2px solid var(--azul);
  border-bottom: 2px solid var(--azul);
  border-left: 3px solid var(--vinho);
  border-radius: var(--raio-p);
  font-size: 0.95rem;
  line-height: 1.6;
  scroll-margin-top: 1rem;
}
.criatura > .caixa-titulo { --cor: var(--texto); margin-bottom: 0; }
.criatura p + p { margin-top: 0.45rem; }
.arte { margin: 1rem 0 0.8rem; }
.arte img {
  display: block;
  width: 100%;
  max-width: 26rem;
  height: auto;
  margin: 0 auto;
  border-radius: var(--raio-p);
  background: #fff;
  border: 1px solid var(--ouro);
  padding: 0.3rem;
}
.perfil {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.2rem 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--linha);
  margin-bottom: 0.6rem;
  font-size: var(--t--2);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.perfil span:first-child { color: var(--vinho); }
.perfil span:last-child { color: var(--fosco); }
.statgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem 1rem; margin: 0.4rem 0 0.7rem; }
.stat { background: var(--painel-2); border-radius: 6px; padding: 0.35rem 0.6rem; font-size: 0.9rem; }
.taticas { margin-top: 0.8rem !important; padding-top: 0.6rem; border-top: 1px solid var(--linha); }
a.ver { color: var(--azul); font-weight: 600; text-decoration: none; }
a.ver:hover { text-decoration: underline; }

/* Filtro do bestiário */
.filtro {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center;
  padding: 0.75rem 0; margin: 1rem 0 0;
  background: var(--fundo);
  border-bottom: 1px solid var(--linha);
}
.filtro input, .filtro select {
  font: inherit; font-size: 0.95rem;
  background: var(--painel); color: var(--texto);
  border: 1px solid var(--linha-2); border-radius: var(--raio-p);
  padding: 0.45rem 0.7rem;
}
.filtro input { flex: 1 1 14rem; }
.filtro .conta { font-size: var(--t--1); color: var(--fosco); }
.criatura[hidden] { display: none; }

/* --- 6. Sumário do livro -------------------------------------------------- */
.sumario { margin-top: 1.5rem; padding: 0.4rem 1.15rem 1rem; }
.sumario > h2 { font-family: var(--ui); font-size: var(--t--2); font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ouro); margin: 0.8rem 0 0.4rem; }
.sumario details { border-top: 1px solid var(--linha); }
.sumario summary { cursor: pointer; padding: 0.6rem 0; font-family: var(--serifada); font-size: 1.15rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.sumario summary::-webkit-details-marker { display: none; }
.sumario summary::after { content: "+"; color: var(--fosco); font-family: var(--ui); }
.sumario details[open] summary::after { content: "−"; }
.sumario summary:hover { color: var(--ouro); }
.sumario ol { list-style: none; margin: 0 0 0.8rem; padding: 0; columns: 2 14rem; column-gap: 1.5rem; }
.sumario li { break-inside: avoid; padding: 0.15rem 0; font-size: 0.94rem; }
.sumario a { color: var(--texto); text-decoration: none; }
.sumario a:hover { color: var(--ouro); text-decoration: underline; }
.sumario .avulso { padding: 0.6rem 0; border-top: 1px solid var(--linha); }

.voltar-topo {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 40;
  background: var(--painel-2); color: var(--texto);
  border: 1px solid var(--linha); border-radius: var(--raio-p);
  font-size: var(--t--2); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.5rem 0.8rem; text-decoration: none; box-shadow: var(--sombra);
}
.voltar-topo:hover { color: var(--ouro); }
@media (max-width: 40rem) { .voltar-topo { bottom: 4rem; } }

/* --- 7. Vitrine: capas dos livros ---------------------------------------- */
.estante { margin-top: 1.75rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1.2rem; }
.volume {
  display: flex; flex-direction: column; text-decoration: none;
  background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio);
  overflow: hidden; box-shadow: var(--sombra);
  transition: border-color 140ms ease, transform 140ms ease;
}
.volume:hover { border-color: var(--ouro); transform: translateY(-2px); }
.volume img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; border-bottom: 1px solid var(--linha); }
.volume .capa-ficha { aspect-ratio: 3 / 4; display: grid; place-items: center; background: var(--painel-2); border-bottom: 1px solid var(--linha); }
.volume .corpo { padding: 1rem 1.1rem 1.15rem; display: flex; flex-direction: column; gap: 0.35rem; }
.volume .rubrica { font-size: 0.68rem; }
.volume h3 { font-size: 1.3rem; }
.volume:hover h3 { color: var(--ouro); }
.volume p { font-size: 0.92rem; color: var(--fosco); line-height: 1.5; }

.nucleo { margin-top: 1.5rem; }
.nucleo .regra { max-width: 46rem; }
.diferencas { margin-top: 1.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; list-style: none; padding: 0; }
.diferencas li { background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio); padding: 1rem 1.1rem; font-size: 0.94rem; color: var(--fosco); line-height: 1.55; }
.diferencas strong { display: block; color: var(--texto); font-family: var(--serifada); font-weight: 400; font-size: 1.15rem; margin-bottom: 0.3rem; }
