/* Cartilha em áudio — identidade baseada no PDF:
   verde oliva, detalhes dourados, títulos serifados e texto em Montserrat. */

:root {
  --verde: #667a47;
  --verde-escuro: #4a5932;
  --verde-claro: #eef1e6;
  --dourado: #d9a23a;
  --madeira: #3a2a1f;
  --fundo: #faf8f3;
  --superficie: #ffffff;
  --texto: #34342f;
  --texto-suave: #5b5b52;
  --borda: #e3dfd3;
  --foco: #22300f;
  --sombra: 0 1px 2px rgb(40 35 20 / 6%), 0 8px 28px rgb(40 35 20 / 8%);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --coluna: 46rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --verde-escuro: #b8cc93;
    --verde-claro: #252c1c;
    --fundo: #15180f;
    --superficie: #1f2418;
    --texto: #ebe9e0;
    --texto-suave: #bdbcb1;
    --borda: #353d2b;
    --foco: #f2c46b;
    --sombra: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 28px rgb(0 0 0 / 30%);
    color-scheme: dark;
  }
}

/* Tamanho do texto (botões A− / A+) */
html { font-size: 100%; }
html[data-fonte="1"] { font-size: 112.5%; }
html[data-fonte="2"] { font-size: 125%; }
html[data-fonte="3"] { font-size: 140%; }

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; height: auto; }
a { color: var(--verde-escuro); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
strong { font-weight: 700; }

:focus-visible { outline: 3px solid var(--foco); outline-offset: 3px; border-radius: 4px; }
main:focus { outline: none; }

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

.pular {
  position: absolute; left: 1rem; top: -4rem; z-index: 10;
  background: var(--superficie); color: var(--texto); padding: 0.75rem 1rem;
  border-radius: 8px; box-shadow: var(--sombra); font-weight: 600;
}
.pular:focus { top: 1rem; }

/* ---------- Topo ---------- */

.topo {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: calc(var(--coluna) + 2.5rem); margin: 0 auto;
  padding: max(0.75rem, env(safe-area-inset-top)) 1.25rem 0.75rem;
}
.marca {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--verde-escuro); text-decoration: none; line-height: 1.4;
}
.tamanho { display: flex; gap: 0.4rem; flex-shrink: 0; }
.tamanho button {
  min-width: 2.75rem; min-height: 2.75rem; border-radius: 999px;
  border: 1px solid var(--borda); background: var(--superficie); color: var(--texto);
  font: 600 0.95rem var(--sans); cursor: pointer;
}
.tamanho button:hover { border-color: var(--verde); }
.tamanho button:disabled { opacity: 0.4; cursor: default; }

/* ---------- Elementos comuns ---------- */

.sobretitulo {
  display: flex; align-items: center; gap: 1rem; margin: 0 0 1rem;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
}
.sobretitulo::before {
  content: ""; width: 4.5rem; height: 3px; background: var(--dourado); border-radius: 2px; flex-shrink: 0;
}

.rotulo-secao {
  margin: 0 0 1rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--texto-suave);
}

.miolo { max-width: calc(var(--coluna) + 2.5rem); margin: 0 auto; padding: 0 1.25rem 2rem; }

/* ---------- Capa (página inicial) ---------- */

.capa {
  position: relative; color: #fff;
  max-width: calc(var(--coluna) + 4rem); margin: 0 auto;
  background:
    linear-gradient(to bottom, rgb(42 29 20 / 0%) 38%, rgb(42 29 20 / 55%) 70%, rgb(42 29 20 / 80%)),
    var(--madeira) url("img/capa.jpg") center top / cover no-repeat;
  padding: clamp(12rem, 56vw, 25rem) clamp(1.75rem, 6vw, 3.5rem) clamp(2rem, 6vw, 3rem);
  --foco: #fff;
}
.capa::after {
  content: ""; position: absolute; inset: 0.9rem; border: 1.5px solid rgb(255 255 255 / 80%);
  pointer-events: none;
}
.capa-conteudo { position: relative; z-index: 1; }
.capa h1 {
  margin: 0 0 1.25rem; font-family: var(--serif); font-weight: 500;
  font-size: clamp(2.5rem, 9.5vw, 4.4rem); line-height: 1.02; letter-spacing: -0.01em;
  text-shadow: 0 2px 18px rgb(0 0 0 / 35%);
}
.capa h1 .quebra { display: block; }
.capa-sub { margin: 0 0 2rem; max-width: 32rem; font-size: 1rem; letter-spacing: 0.02em; opacity: 0.95; }
.capa-autoria {
  display: flex; justify-content: space-between; gap: 1rem; margin: 0; padding-top: 1rem;
  border-top: 1px solid rgb(255 255 255 / 60%);
  font-size: 0.85rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
}

@media (min-width: 52rem) {
  .capa { margin-top: 0.5rem; border-radius: 6px; overflow: hidden; }
}

.intro { padding: 2.5rem 0 1rem; }
.intro h2 {
  margin: 0 0 0.5rem; font-family: var(--serif); font-weight: 600; font-size: 2rem; line-height: 1.2;
  color: var(--verde-escuro);
}
.intro p { margin: 0; color: var(--texto-suave); }

/* ---------- Lista de capítulos ---------- */

.lista-capitulos { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.cartao {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 1.25rem 1.25rem 1.25rem 1.5rem; min-height: 8rem;
  background: var(--superficie); border: 1px solid var(--borda); border-radius: 14px;
  box-shadow: var(--sombra); color: inherit; text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.cartao:hover { border-color: var(--verde); transform: translateY(-2px); }
.cartao-num {
  flex: 0 0 3.25rem; font-family: var(--serif); font-weight: 700; font-size: 3rem; line-height: 1;
  color: var(--verde);
}
.cartao-texto { display: grid; gap: 0.2rem; flex: 1; min-width: 0; }
.cartao-rotulo { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--texto-suave); }
.cartao-titulo { font-family: var(--serif); font-weight: 600; font-size: 1.55rem; line-height: 1.15; color: var(--verde-escuro); }
.cartao-resumo { font-size: 0.92rem; line-height: 1.5; color: var(--texto-suave); }
.cartao-duracao {
  justify-self: start; margin-top: 0.5rem; padding: 0.25rem 0.75rem; border-radius: 999px;
  background: var(--verde-claro); color: var(--verde-escuro); font-size: 0.8rem; font-weight: 600;
}
.cartao img {
  flex: 0 0 auto; width: 5.5rem; height: 5.5rem; object-fit: contain;
  background: #f4efe3; border-radius: 50%; padding: 0.5rem;
}
@media (max-width: 30rem) {
  .cartao { align-items: flex-start; gap: 1rem; padding: 1.1rem; }
  .cartao-num { flex-basis: 2.25rem; font-size: 2.25rem; }
  .cartao img { width: 4rem; height: 4rem; }
}

/* ---------- Abertura do capítulo ---------- */

.abertura {
  position: relative; overflow: hidden; color: #fff; background: var(--verde);
  max-width: calc(var(--coluna) + 4rem); margin: 0 auto;
  padding: 2.5rem clamp(1.5rem, 6vw, 3.5rem) 5rem;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem;
  --foco: #fff;
}
.abertura::before, .abertura::after {
  content: ""; position: absolute; border-radius: 50%; border: 1px solid rgb(255 255 255 / 28%);
  pointer-events: none;
}
.abertura::before { width: 26rem; height: 26rem; right: -9rem; bottom: -15rem; }
.abertura::after { width: 20rem; height: 20rem; right: -4rem; bottom: -13rem; }
.abertura-conteudo { position: relative; z-index: 1; }
.abertura-num {
  margin: 0; font-family: var(--serif); font-weight: 700; line-height: 0.85;
  font-size: clamp(5.5rem, 22vw, 9rem);
}
.abertura h1 {
  margin: 0.75rem 0 0; font-family: var(--serif); font-weight: 500;
  font-size: clamp(2.1rem, 7vw, 3.1rem); line-height: 1.08;
}
.abertura-ilustra {
  position: relative; z-index: 1; flex-shrink: 0;
  width: 8.5rem; height: 8.5rem; border-radius: 50%; background: #f4efe3;
  display: grid; place-items: center; padding: 0.9rem;
}
.abertura-ilustra img { width: 100%; height: 100%; object-fit: contain; }
@media (max-width: 34rem) {
  .abertura { flex-direction: column-reverse; align-items: flex-start; }
  .abertura-ilustra { width: 5.5rem; height: 5.5rem; padding: 0.6rem; }
}
@media (min-width: 52rem) {
  .abertura { margin-top: 0.5rem; border-radius: 6px; }
}

/* ---------- Player ---------- */

.player {
  position: relative; z-index: 2; margin: -3rem 0 2rem;
  background: var(--superficie); border: 1px solid var(--borda); border-radius: 18px;
  box-shadow: var(--sombra); padding: 1.5rem clamp(1.25rem, 4vw, 2rem);
}
.player .rotulo-secao { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.25rem; color: var(--verde-escuro); }
.player .rotulo-secao::before { content: ""; width: 2rem; height: 3px; background: var(--dourado); border-radius: 2px; }
.player-info { margin: 0 0 1rem; font-size: 0.9rem; color: var(--texto-suave); }
.player audio { width: 100%; }

.linha-tocar { margin-bottom: 1rem; }
.btn-tocar {
  display: inline-flex; align-items: center; gap: 0.85rem;
  min-height: 3.75rem; padding: 0.5rem 1.6rem 0.5rem 0.6rem; border: 0; border-radius: 999px;
  background: var(--verde); color: #fff; font: 700 1.1rem var(--sans); cursor: pointer;
  box-shadow: 0 4px 14px rgb(74 89 50 / 35%);
}
.btn-tocar:hover { background: #586a3c; }
.btn-tocar svg {
  width: 2.75rem; height: 2.75rem; padding: 0.55rem; border-radius: 50%;
  background: rgb(255 255 255 / 18%); fill: currentColor;
}
.btn-tocar .ic-pause, .tocando .btn-tocar .ic-play { display: none; }
.tocando .btn-tocar .ic-pause { display: block; }

.progresso { width: 100%; height: 2rem; margin: 0; accent-color: var(--verde); cursor: pointer; }
.tempos {
  display: flex; justify-content: space-between; margin-top: -0.2rem;
  font-size: 0.85rem; font-variant-numeric: tabular-nums; color: var(--texto-suave);
}

.botoes { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.85rem; }
.botoes button, .btn-inicio {
  min-height: 2.9rem; padding: 0.4rem 1rem; border-radius: 999px;
  border: 1px solid var(--borda); background: var(--fundo); color: var(--texto);
  font: 600 0.92rem var(--sans); cursor: pointer;
}
.botoes button:hover, .btn-inicio:hover { border-color: var(--verde); }
.btn-velocidade { flex: 1 1 auto; }

.retomar { margin: 1rem 0 0; font-size: 0.92rem; color: var(--texto-suave); }
.btn-inicio { min-height: 2.5rem; margin-left: 0.25rem; }
.aviso { margin: 0.5rem 0 0; font-size: 0.92rem; font-weight: 600; color: #a33a1f; }
.aviso:empty { display: none; }
@media (prefers-color-scheme: dark) { .aviso { color: #f19a7f; } }
.player-rodape { margin: 1rem 0 0; padding-top: 1rem; border-top: 1px solid var(--borda); font-size: 0.9rem; color: var(--texto-suave); }
.baixar { font-weight: 600; }
.em-breve { margin: 0.5rem 0 0; color: var(--texto-suave); }

/* ---------- Índice ---------- */

.indice {
  margin: 0 0 2.5rem; padding: 1.25rem 1.5rem; border-radius: 14px;
  background: var(--verde-claro);
}
.indice ol { margin: 0; padding-left: 1.4rem; display: grid; gap: 0.35rem; }
.indice li::marker { color: var(--verde); font-weight: 700; }
.indice a { font-weight: 500; }

/* ---------- Texto do capítulo ---------- */

.texto { max-width: 40rem; }
.texto > .rotulo-secao { display: flex; align-items: center; gap: 0.75rem; }
.texto > .rotulo-secao::before { content: ""; width: 2rem; height: 3px; background: var(--dourado); border-radius: 2px; }
.texto p { margin: 0 0 1.15rem; }
.texto h3 {
  margin: 2.75rem 0 1rem; scroll-margin-top: 1.5rem;
  font-size: 1.05rem; font-weight: 700; letter-spacing: 0.03em; line-height: 1.4;
  text-transform: uppercase; color: var(--verde-escuro);
}
.texto h4 { margin: 2rem 0 0.75rem; font-size: 1.05rem; font-weight: 600; color: var(--verde-escuro); }
.texto ul { margin: 0 0 1.25rem; padding-left: 1.4rem; }
.texto ul li { margin-bottom: 0.45rem; padding-left: 0.25rem; }
.texto ul li::marker { color: var(--verde); font-size: 1.1em; }

.destaque {
  margin: 1.75rem 0; padding: 0.25rem 0 0.25rem 1.25rem; border-left: 3px solid var(--dourado);
}
.destaque p {
  margin: 0; font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: 1.5rem; line-height: 1.35; color: var(--verde-escuro);
}

.perguntas {
  margin: 1.5rem 0 1.75rem; padding: 1.25rem 1.5rem; border-radius: 14px;
  background: var(--verde-claro); border-left: 4px solid var(--dourado);
}
.perguntas-rotulo {
  margin: 0 0 0.6rem !important; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--verde-escuro);
}
.perguntas ol { margin: 0; padding-left: 1.6rem; display: grid; gap: 0.6rem; }
.perguntas li { font-weight: 600; padding-left: 0.25rem; }
.perguntas li::marker { font-family: var(--serif); font-weight: 700; font-size: 1.2em; color: var(--verde); }

.passos {
  list-style: none; margin: 1.25rem 0 1.5rem; padding: 0; counter-reset: passo;
  display: flex; flex-wrap: wrap; gap: 0.6rem 0.5rem; align-items: center;
}
.passos li {
  display: flex; align-items: center; gap: 0.5rem; counter-increment: passo;
  font-size: 0.85rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--verde-escuro);
}
.passos li:not(:last-child)::after { content: "→" / ""; color: var(--dourado); font-weight: 700; }
.passos li::before {
  content: counter(passo) / ""; display: grid; place-items: center; width: 1.6rem; height: 1.6rem;
  border-radius: 50%; background: var(--verde); color: #fff; font-size: 0.75rem;
}

/* ---------- Navegação entre capítulos ---------- */

.navegacao { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--borda); }
.navegacao a {
  display: grid; gap: 0.25rem; padding: 1rem 1.25rem; border-radius: 14px;
  border: 1px solid var(--borda); background: var(--superficie); text-decoration: none; color: inherit;
}
.navegacao a:hover { border-color: var(--verde); }
.nav-prox { text-align: right; }
.nav-dir { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--texto-suave); }
.nav-titulo { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; line-height: 1.2; color: var(--verde-escuro); }
@media (max-width: 34rem) {
  .navegacao { grid-template-columns: 1fr; }
  .nav-prox { text-align: left; }
  .navegacao > span:empty { display: none; }
}
.voltar { margin: 1.5rem 0 0; text-align: center; font-weight: 600; }

/* ---------- Rodapé ---------- */

.rodape {
  max-width: calc(var(--coluna) + 2.5rem); margin: 2rem auto 0;
  padding: 2rem 1.25rem max(2.5rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--borda); font-size: 0.88rem; color: var(--texto-suave);
}
.rodape p { margin: 0 0 0.75rem; }
.rodape strong { color: var(--texto); }
.rodape-nota { font-size: 0.8rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
html { scroll-behavior: smooth; }

/* Algarismos alinhados (a Cormorant usa algarismos antigos por padrão: "01" pareceria "OI") */
.abertura-num, .cartao-num, .perguntas li::marker, .nav-titulo { font-variant-numeric: lining-nums; font-feature-settings: "lnum" 1; }
.cartao-num:empty { display: none; }

/* ---------- Karaokê (texto sincronizado com a fala) ---------- */

:root { --bloco: #f5efdf; --marca: #f2d38c; --marca-texto: #2b2a22; }
@media (prefers-color-scheme: dark) {
  :root { --bloco: #2a301f; --marca: #8a6a22; --marca-texto: #ffffff; }
}

.acompanhar { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--borda); }
.chave { display: inline-flex; align-items: center; gap: 0.75rem; min-height: 2.75rem; font-weight: 600; font-size: 0.95rem; cursor: pointer; }
.chave input {
  appearance: none; -webkit-appearance: none; position: relative; flex-shrink: 0; margin: 0; cursor: pointer;
  width: 3rem; height: 1.75rem; border-radius: 999px; background: var(--texto-suave); transition: background 0.15s;
}
.chave input::after {
  content: ""; position: absolute; top: 0.225rem; left: 0.225rem; width: 1.3rem; height: 1.3rem; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 30%); transition: transform 0.15s;
}
.chave input:checked { background: var(--verde); }
.chave input:checked::after { transform: translateX(1.25rem); }
.dica { margin: 0.25rem 0 0; font-size: 0.85rem; line-height: 1.5; color: var(--texto-suave); }

.texto .falando { background: var(--bloco); box-shadow: 0 0 0 0.4rem var(--bloco); border-radius: 4px; }
.texto .w.atual { background: var(--marca); color: var(--marca-texto); box-shadow: 0 0 0 0.12em var(--marca); border-radius: 3px; }
@media (hover: hover) {
  .tem-karaoke .texto .w { cursor: pointer; }
  .tem-karaoke .texto .w:hover { text-decoration: underline; text-decoration-color: var(--dourado); text-decoration-thickness: 2px; }
}
@media (forced-colors: active) {
  .texto .w.atual { forced-color-adjust: none; background: Highlight; color: HighlightText; }
}

/* Mini player fixo */
.mini {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 0.75rem; max-width: calc(100% - 1.5rem);
  padding: 0.45rem 0.6rem 0.45rem 0.45rem; border-radius: 999px;
  background: var(--superficie); border: 1px solid var(--borda); box-shadow: 0 6px 24px rgb(0 0 0 / 18%);
}
.mini[hidden] { display: none; }
.mini-tocar {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.9rem; padding: 0.3rem 1.1rem 0.3rem 0.35rem;
  border: 0; border-radius: 999px; background: var(--verde); color: #fff; font: 700 0.95rem var(--sans); cursor: pointer;
}
.mini-tocar svg { width: 2.2rem; height: 2.2rem; padding: 0.45rem; border-radius: 50%; background: rgb(255 255 255 / 18%); fill: currentColor; }
.mini .ic-pause, .mini.tocando .ic-play { display: none; }
.mini.tocando .ic-pause { display: block; }
.mini-tempo { font-size: 0.85rem; font-variant-numeric: tabular-nums; color: var(--texto-suave); white-space: nowrap; }
.mini-seguir {
  min-height: 2.9rem; padding: 0.3rem 1rem; border-radius: 999px; border: 1px solid var(--verde);
  background: transparent; color: var(--verde-escuro); font: 600 0.9rem var(--sans); white-space: nowrap; cursor: pointer;
}
body.com-mini { padding-bottom: 5.5rem; }
@media (max-width: 26rem) { .mini-tempo { display: none; } }
