/* A HISTÓRIA CONTINUA · estilos compartilhados */
:root {
  --accent: #8E1B25; --accent-escuro: #6E1520;
  --paper: #FBF4EC; --paper-2: #F4E9DC;
  --ink: #4A2E26; --ink-soft: #7B5E54;
  --line: #E8D6C8; --gold: #B8925A;
  --deep: #2A1612; --deep-ink: #F3E3CB;
  --ok: #3E6B3A;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --script: 'Great Vibes', cursive;
  --sans: 'Montserrat', system-ui, sans-serif;
}
body.tema-dourado {
  --accent: #8C6A3C; --accent-escuro: #6F532D;
  --paper: #F8F2E8; --paper-2: #F0E6D6;
  --ink: #4E3F31; --ink-soft: #7A6A58; --line: #E2D5C0;
  --deep: #2E261C; --deep-ink: #F1E6D2;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: #E9DFD3; color: var(--ink); font-family: var(--sans);
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
.app {
  max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--paper);
  position: relative; overflow-x: hidden;
}
@media (min-width: 600px) { .app { box-shadow: 0 0 60px rgba(60,30,20,.15); } }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; color: var(--ink); }
a { color: var(--accent); }
img { max-width: 100%; }
.oculto { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Tipografia */
.eyebrow { font-family: var(--serif); font-size: 13px; letter-spacing: .32em; text-transform: uppercase; color: var(--ink-soft); }
.titulo-script { font-family: var(--script); font-weight: 400; color: var(--accent); line-height: 1.1; margin: 0; }
.titulo-caps { font-family: var(--serif); font-weight: 400; letter-spacing: .28em; text-transform: uppercase; margin: 0; }
.italico { font-family: var(--serif); font-style: italic; color: var(--ink-soft); line-height: 1.45; }
.miudo { font-size: 12px; line-height: 1.55; color: var(--ink-soft); }
.coracao { display: block; margin: 6px auto; }
.centro { text-align: center; }

/* Botões */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 54px; border-radius: 30px; border: 1px solid var(--accent);
  background: var(--accent); color: #FFF8EE; font-size: 12px; letter-spacing: .22em;
  font-weight: 500; text-transform: uppercase; text-decoration: none; padding: 0 20px;
  transition: background .2s, transform .1s;
}
.btn:hover { background: var(--accent-escuro); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.secundario { background: transparent; color: var(--accent); }
.btn.secundario:hover { background: rgba(142,27,37,.06); }
.btn.claro { background: rgba(255,248,238,.92); color: var(--accent); border-color: transparent; }
.btn.pequeno { min-height: 40px; font-size: 11px; letter-spacing: .16em; width: auto; padding: 0 16px; }
.link-btn { background: none; border: none; color: var(--accent); font-size: 13px; text-decoration: underline; padding: 6px; }

/* Formulários */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo label, .rotulo { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft); font-weight: 500; }
.campo input, .campo textarea, .campo select {
  min-height: 48px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
  background: #FFFDF9; font-size: 16px;
}
.campo textarea { font-family: var(--serif); font-size: 19px; line-height: 1.45; resize: vertical; }
.contador { align-self: flex-end; font-size: 11px; color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line);
  background: #FFFDF9; color: var(--ink); font-size: 13px;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #FFF8EE; }

/* Cartões e blocos */
.secao { padding: 26px 24px; display: flex; flex-direction: column; gap: 16px; }
.cartao { background: #FFFDF9; border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.linha-ouro { height: 1px; background: var(--line); border: 0; margin: 4px 0; }
.aviso {
  background: #FFF6E0; border: 1px solid #EAD29A; color: #6A4B12; border-radius: 12px;
  padding: 12px 14px; font-size: 13px; line-height: 1.5;
}
.aviso.ok { background: #EEF5EC; border-color: #BFD5BA; color: var(--ok); }

/* Topo com voltar */
.topo {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: rgba(251,244,236,.94); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
body.tema-dourado .topo { background: rgba(248,242,232,.94); }
.topo .voltar {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #FFFDF9;
  display: grid; place-items: center; color: var(--ink);
}
.topo .titulo-topo { font-family: var(--serif); font-size: 15px; letter-spacing: .26em; text-transform: uppercase; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(440px, calc(100% - 32px));
  background: var(--ink); color: #FFF8EE; border-radius: 14px; padding: 14px 16px; font-size: 13px;
  line-height: 1.45; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 50;
}

/* ========== Livro (leitor) ========== */
.leitor { position: relative; height: 100vh; height: 100dvh; overflow: hidden; background: var(--paper); }
.leitor .pagina { position: absolute; inset: 0; display: flex; flex-direction: column; opacity: 0; pointer-events: none; transition: opacity .45s ease; }
.leitor .pagina.ativa { opacity: 1; pointer-events: auto; }
.pg-foto { position: relative; flex: 1 1 58%; min-height: 0; overflow: hidden; }
.pg-foto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pg-foto .fade { position: absolute; left: 0; right: 0; bottom: 0; height: 40%; background: linear-gradient(180deg, rgba(0,0,0,0), var(--paper)); }
.pg-texto { flex: 0 0 auto; padding: 4px 30px 96px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pg-texto p { font-family: var(--serif); font-style: italic; font-size: 20px; line-height: 1.5; color: var(--ink); margin: 6px 0 0; max-width: 360px; }
.capa { position: absolute; inset: 0; }
.capa img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.capa .veu { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(30,15,10,.35) 0%, rgba(30,15,10,.05) 35%, rgba(30,15,10,.15) 60%, rgba(30,15,10,.65) 100%); }
.capa .topo-capa { position: absolute; top: 28px; left: 0; right: 0; text-align: center; color: #FFF8EE; font-size: 10px; letter-spacing: .34em; font-weight: 500; }
.capa .rodape-capa { position: absolute; left: 0; right: 0; bottom: 110px; text-align: center; color: #FFF8EE; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 24px; }
.capa .rodape-capa .nosso { font-family: var(--serif); font-size: 30px; letter-spacing: .5em; padding-left: .5em; }
.capa .rodape-capa .natal { font-family: var(--script); font-size: 76px; line-height: .9; }
.capa .rodape-capa .fam { font-size: 11px; letter-spacing: .32em; margin-top: 8px; }
.capa .rodape-capa .para { font-family: var(--serif); font-style: italic; font-size: 18px; margin-bottom: 6px; }
.pg-dedicatoria, .pg-mariana, .pg-final-sem-foto { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 34px 110px; text-align: center; gap: 10px; }
.pg-dedicatoria .texto { font-family: var(--serif); font-style: italic; font-size: 24px; line-height: 1.5; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.pg-dedicatoria .assina { font-family: var(--script); font-size: 34px; color: var(--accent); }
.pg-mariana { background: var(--deep); color: var(--deep-ink); }
.pg-mariana p { font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1.55; margin: 0; color: var(--deep-ink); white-space: pre-wrap; }
.pg-mariana .assina { font-family: var(--script); font-size: 38px; color: #E7C99A; }
.pg-calendario { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 20px 110px; gap: 14px; text-align: center; }
.pg-calendario canvas { width: min(100%, 340px); height: auto; box-shadow: 0 10px 28px rgba(60,30,20,.18); border-radius: 3px; background: #fff; }
.nav-livro {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); gap: 10px;
}
.nav-livro .seta { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,253,249,.92); color: var(--ink); display: grid; place-items: center; }
.nav-livro .seta[disabled] { opacity: .35; }
.pontos { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; }
.pontos button { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 1px solid var(--gold); background: transparent; }
.pontos button[aria-current="true"] { background: var(--accent); border-color: var(--accent); }
.fechar-livro { position: absolute; top: 14px; left: 14px; z-index: 6; width: 42px; height: 42px; border-radius: 50%; border: none; background: rgba(255,248,238,.88); color: var(--ink); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.12); }

/* Impressão do livro (PDF) */
#impressao { display: none; }
@media print {
  @page { size: A4 portrait; margin: 0; }
  body { background: #fff; }
  body > *:not(#impressao) { display: none !important; }
  #impressao { display: block; }
  .folha-print { width: 210mm; height: 297mm; page-break-after: always; break-after: page; position: relative; overflow: hidden; background: var(--paper); display: flex; flex-direction: column; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .folha-print img.foto { width: 100%; height: 190mm; object-fit: cover; display: block; }
  .folha-print .txt { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 22mm; gap: 3mm; }
  .folha-print .txt p { font-family: var(--serif); font-style: italic; font-size: 17pt; line-height: 1.5; margin: 0; }
  .folha-print.escura { background: var(--deep); color: var(--deep-ink); }
  .folha-print.so-texto .txt { padding: 40mm 26mm; }
  .folha-print img.cal { width: 100%; height: 100%; object-fit: contain; }
}
