/* ==========================================================================
   Teste de direção visual: "livro anotado".
   Folha de livro envelhecida, conteúdo escrito à mão, anotações em caneta
   terracota na margem. Móveis do livro (capítulo, fólio, cabeçalho corrido)
   ficam na fonte impressa, o resto é mão.
   ========================================================================== */

:root {
  --papel: #F1E6D1;
  --papel-claro: #FAF4E8;
  --tinta: #1F1B16;
  --tinta-2: #3E352C;
  --grafite: #6E6152;
  --terracota: #C1502E;
  --coral: #E8664B;
  --areia: #D9A566;

  --mao: 'Caveat', 'Segoe Print', cursive;
  --corpo: 'Kalam', 'Segoe Print', cursive;
  --nota: 'Reenie Beanie', 'Segoe Print', cursive;
  --livro: 'IM Fell English', Georgia, serif;
  --livro-sc: 'IM Fell English SC', Georgia, serif;

  /* Fibra fina do papel + manchas largas de envelhecimento. */
  --textura-fibra: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .26 0 0 0 0 .14 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --textura-mancha: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='900'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.006' numOctaves='4' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .38 0 0 0 0 .16 0 0 0 .5 -.12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  background-color: var(--papel);
  background-image: var(--textura-fibra), var(--textura-mancha);
  background-attachment: fixed, fixed;
  background-size: auto, cover;
  background-repeat: repeat, no-repeat;
  color: var(--tinta-2);
  font-family: var(--corpo);
  font-weight: 400;
  font-size: 1.14rem;
  line-height: 1.7;
  overflow-x: clip;
}

/* Borda escurecida da folha e sombra da lombada. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  background:
    radial-gradient(ellipse 120% 90% at 50% 45%, transparent 58%, rgba(110, 70, 25, .16) 100%);
}
@media (min-width: 900px) {
  body::after {
    content: '';
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 70px;
    pointer-events: none;
    z-index: 60;
    background: linear-gradient(to right, rgba(60, 38, 15, .2), rgba(60, 38, 15, .06) 40%, transparent);
  }
}

::selection { background: rgba(217, 165, 102, .55); color: var(--tinta); }

img, video { max-width: 100%; display: block; }

a { color: var(--tinta); text-decoration: underline; text-decoration-color: var(--terracota); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
a:hover { text-decoration-style: wavy; }
:focus-visible { outline: 2px dashed var(--terracota); outline-offset: 4px; border-radius: 4px; }

p { margin: 0 0 1rem; }

/* ---------------- cabeçalho corrido ---------------- */

.cabecalho {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--papel);
  background-image: var(--textura-fibra), var(--textura-mancha);
  background-attachment: fixed, fixed;
  background-size: auto, cover;
  background-repeat: repeat, no-repeat;
  transition: box-shadow .3s;
}
.cabecalho.grudado { box-shadow: 0 1px 0 rgba(31, 27, 22, .14), 0 10px 20px -16px rgba(60, 38, 15, .5); }

.cabecalho-dentro {
  max-width: 1080px;
  margin: 0 auto;
  padding: .7rem 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.marca {
  font-family: var(--livro-sc);
  font-size: 1.1rem;
  letter-spacing: .16em;
  color: var(--tinta);
  text-decoration: none;
}
.titulo-corrido {
  font-family: var(--livro);
  font-style: italic;
  color: var(--grafite);
  font-size: 1rem;
}
@media (max-width: 720px) { .titulo-corrido { display: none; } }

/* ---------------- página ---------------- */

.pagina {
  position: relative;
  max-width: 840px;
  margin: 0 auto;
  padding: 0 22px;
}

.bloco { padding: clamp(4rem, 9vw, 7rem) 0 clamp(2.5rem, 5vw, 3.5rem); }
.bloco--centro { text-align: center; }
.bloco--centro .pagina > p:not(.capitulo) { margin-left: auto; margin-right: auto; }

.capitulo {
  font-family: var(--livro);
  font-style: italic;
  font-size: 1.08rem;
  color: var(--grafite);
  margin: 0 0 .9rem;
  letter-spacing: .01em;
}
.capitulo b { font-family: var(--livro-sc); font-style: normal; font-weight: 400; letter-spacing: .14em; color: var(--terracota); margin-right: .35em; }

h1, h2, h3 {
  font-family: var(--mao);
  font-weight: 700;
  color: var(--tinta);
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(3rem, 8.2vw, 5.4rem); line-height: .98; letter-spacing: -.01em; }
h2 { font-size: clamp(2.6rem, 6.2vw, 4.1rem); line-height: 1.02; }
h3 { font-size: 2rem; line-height: 1.1; }

.lead { font-size: 1.28rem; line-height: 1.65; color: var(--tinta-2); margin-top: 1.2rem; max-width: 36em; }

.folio {
  font-family: var(--livro);
  color: var(--grafite);
  font-size: 1.1rem;
  text-align: center;
  margin: clamp(3rem, 6vw, 4.5rem) 0 0;
  letter-spacing: .3em;
}

.ornamento {
  display: block;
  text-align: center;
  font-family: var(--livro);
  color: var(--terracota);
  font-size: 1.6rem;
  line-height: 1;
  opacity: .8;
}

/* ---------------- escrita que acontece ---------------- */

/* Cada palavra entra da esquerda para a direita, como tinta correndo. */
.escrever .palavra {
  display: inline-block;
  clip-path: inset(-60% 100% -60% -60%);
  opacity: .2;
}
.escrever.visivel .palavra {
  animation: escrever .55s cubic-bezier(.55, .1, .35, 1) forwards;
  animation-delay: calc(var(--i) * 95ms);
}
@keyframes escrever {
  to { clip-path: inset(-60% -60% -60% -60%); opacity: 1; }
}
/* Terminada a escrita, nada de recorte: acentos e caudas das letras ficam inteiros. */
.escrever.escrito .palavra { clip-path: none; opacity: 1; animation: none; }

/* Riscos de caneta: sublinhado, círculo, seta, check. */
.risco { position: absolute; overflow: visible; pointer-events: none; }
.risco path {
  fill: none;
  stroke: var(--terracota);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  /* Vão maior que o traço: as pontas arredondadas não aparecem antes da hora. */
  stroke-dasharray: 1 2;
  stroke-dashoffset: 1.05;
  transition: stroke-dashoffset .9s cubic-bezier(.6, .1, .3, 1);
  transition-delay: calc(var(--total, 0) * 95ms + 250ms);
}
.risco path + path { transition-delay: calc(var(--total, 0) * 95ms + 850ms); }
.visivel .risco path { stroke-dashoffset: 0; }

.marcado { position: relative; white-space: nowrap; }
.marcado .risco { left: -2%; bottom: -.14em; width: 104%; height: .32em; }

.circulado { position: relative; display: inline-block; padding: 0 .12em; }
.circulado .risco { inset: -22% -24% -26% -22%; width: 146%; height: 148%; }
.circulado .risco path { stroke-width: 2.6; }

/* Palavra corrigida: risca e escreve a certa depois. */
.corrigido { position: relative; color: var(--grafite); text-decoration: none; }
.corrigido::after {
  content: '';
  position: absolute;
  left: -4%; right: -4%; top: 58%;
  height: .09em;
  border-radius: 3px;
  background: var(--terracota);
  transform: rotate(-2deg) scaleX(0);
  transform-origin: left center;
  margin-top: -.045em;
  transition: transform .45s cubic-bezier(.6, .1, .3, 1);
  transition-delay: calc(var(--total, 0) * 95ms + 100ms);
}
.visivel .corrigido::after { transform: rotate(-2deg) scaleX(1); }

/* ---------------- notas de margem ---------------- */

.nota {
  font-family: var(--nota);
  color: var(--terracota);
  font-size: 1.75rem;
  line-height: 1.05;
  margin: 0;
}
.nota--margem {
  display: block;
  margin: 1.4rem 0 0;
  transform: rotate(-2deg);
  max-width: 22ch;
}
@media (min-width: 1320px) {
  .nota--margem {
    position: absolute;
    left: calc(100% + 30px);
    width: 200px;
    margin: 0;
    top: var(--topo, 0);
    transform: rotate(var(--giro, -4deg));
  }
  .nota--margem.esq { left: auto; right: calc(100% + 30px); text-align: right; }
}

/* ---------------- botões ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--mao);
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1;
  padding: .5rem 1.45rem .62rem;
  color: var(--tinta);
  background: transparent;
  border: 2.5px solid var(--tinta);
  border-radius: 255px 16px 225px 16px / 16px 225px 16px 255px;
  box-shadow: 0 4px 0 -1px var(--tinta);
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.btn:hover { transform: translateY(-3px); box-shadow: 0 7px 0 -1px var(--tinta); text-decoration: none; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 -1px var(--tinta); transition-duration: .06s; }
.btn svg { width: 1.05em; height: 1.05em; flex: none; }

.btn--tinta { background: var(--terracota); color: #FBF5EA; }
.btn--pequeno { font-size: 1.3rem; padding: .32rem 1rem .42rem; border-width: 2px; box-shadow: 0 3px 0 -1px var(--tinta); }
.btn--pequeno:hover { transform: translateY(-2px); box-shadow: 0 5px 0 -1px var(--tinta); }
.btn--pequeno:active { transform: translateY(2px); box-shadow: 0 1px 0 -1px var(--tinta); }
.btn[disabled] { opacity: .6; cursor: wait; }

.acao { margin-top: 2.2rem; display: flex; flex-wrap: wrap; align-items: center; gap: 1.1rem 1.6rem; }
.bloco--centro .acao { justify-content: center; }

.acao .nota { display: inline-flex; align-items: center; gap: .3rem; font-size: 1.6rem; transform: rotate(-3deg); }
.seta { position: relative; width: 56px; height: 34px; flex: none; }
.seta .risco { inset: 0; width: 100%; height: 100%; }

/* ---------------- herói ---------------- */

.heroi { padding-top: clamp(3.5rem, 8vw, 6rem); }
.heroi h1 { font-size: clamp(3rem, 7vw, 5.2rem); text-wrap: wrap; }
/* Quebras fixas do título: "organizar" fecha a segunda linha. Em tela estreita o texto quebra sozinho. */
.heroi h1 .quebra { display: none; }
@media (min-width: 700px) { .heroi h1 .quebra { display: inline; } }

.bilhete {
  margin-top: 2rem;
  font-size: 1.3rem;
  line-height: 1.6;
  max-width: 38em;
}
.bilhete .assina { font-family: var(--nota); font-size: 2.1rem; color: var(--tinta); display: block; margin-top: .2rem; transform: rotate(-3deg); transform-origin: left; }

/* ---------------- fichas pautadas ---------------- */

.fichas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2.4rem 2rem;
  margin-top: 3rem;
}

.ficha {
  position: relative;
  background-color: #FCF8EE;
  padding: 18px 24px 26px;
  box-shadow: 0 1px 2px rgba(40, 25, 10, .1), 0 14px 26px -14px rgba(60, 38, 15, .45);
  transform: rotate(-1.4deg);
}
.ficha:nth-child(2n) { transform: rotate(1.2deg); margin-top: 1.4rem; }
.ficha h3 { font-size: 1.9rem; line-height: 1.15; padding-bottom: 10px; margin-bottom: 6px; border-bottom: 1.5px solid rgba(193, 80, 46, .55); }
.ficha p {
  line-height: 28px;
  font-size: 1.08rem;
  margin: 0;
  padding-top: 2px;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 27px, rgba(84, 118, 160, .24) 27px, rgba(84, 118, 160, .24) 28px);
  background-position: 0 3px;
}

/* Fita adesiva. */
.fita::before {
  content: '';
  position: absolute;
  top: -15px;
  left: 50%;
  width: 118px;
  height: 30px;
  transform: translateX(-50%) rotate(-3deg);
  background: rgba(217, 165, 102, .5);
  box-shadow: 0 1px 2px rgba(60, 38, 15, .12);
  clip-path: polygon(3% 0, 97% 4%, 100% 20%, 97% 40%, 100% 62%, 96% 100%, 4% 96%, 0 78%, 3% 55%, 0 30%);
  z-index: 2;
}
.fita--canto::before { left: 16%; transform: translateX(-50%) rotate(-32deg); top: -8px; }

/* ---------------- template ---------------- */

.caderno {
  position: relative;
  margin-top: 3rem;
}
.caderno h3 { font-size: 2.4rem; }
.caderno > p { margin-top: .8rem; }

.checklist { list-style: none; padding: 0; margin: 1.6rem 0 2rem; }
.checklist li {
  position: relative;
  padding-left: 2.6rem;
  margin: .55rem 0;
  font-size: 1.2rem;
}
.checklist li::before {
  content: '';
  position: absolute;
  left: 0; top: .32em;
  width: 1.3rem; height: 1.3rem;
  border: 2px solid var(--tinta-2);
  border-radius: 4px 7px 3px 8px / 7px 3px 8px 4px;
  transform: rotate(-3deg);
}
.checklist li::after {
  content: '';
  position: absolute;
  left: .05rem; top: -.05em;
  width: 1.75rem; height: 1.6rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 26'%3E%3Cpath d='M3 14c2 1 4 4 6 8 3-7 8-14 17-20' fill='none' stroke='%23C1502E' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
  transform: scale(0) rotate(-10deg);
  transform-origin: 20% 80%;
  transition: transform .35s cubic-bezier(.3, 1.6, .5, 1);
}
.checklist.visivel li::after { transform: scale(1) rotate(0); }
.checklist li:nth-child(1)::after { transition-delay: .15s; }
.checklist li:nth-child(2)::after { transition-delay: .3s; }
.checklist li:nth-child(3)::after { transition-delay: .45s; }
.checklist li:nth-child(4)::after { transition-delay: .6s; }
.checklist li:nth-child(5)::after { transition-delay: .75s; }
.checklist li:nth-child(6)::after { transition-delay: .9s; }
.checklist .nota { font-size: 1.55rem; margin-left: .5rem; display: inline-block; transform: rotate(-4deg); }

.previa-link { font-family: var(--mao); font-size: 1.45rem; }

/* Colagem com fotos presas. */
.colagem {
  max-width: 1000px;
  margin: 4rem auto 0;
  padding: 0 22px;
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr);
  align-items: start;
  gap: 2.5rem;
}
.foto {
  position: relative;
  margin: 0;
  background: #FDFAF3;
  padding: 12px 12px 14px;
  box-shadow: 0 2px 3px rgba(40, 25, 10, .12), 0 22px 40px -22px rgba(60, 38, 15, .55);
}
.foto img, .foto video { width: 100%; height: auto; }
.foto figcaption {
  font-family: var(--nota);
  color: var(--tinta-2);
  font-size: 1.6rem;
  line-height: 1;
  padding-top: 12px;
  text-align: center;
}
.foto--larga { transform: rotate(-1.3deg); margin-top: 1.5rem; }
.foto--celular { transform: rotate(2.4deg); max-width: 260px; justify-self: center; }

@media (max-width: 760px) {
  .colagem { grid-template-columns: 1fr; gap: 3rem; }
}

/* ---------------- preço ---------------- */

.preco { font-size: clamp(5rem, 16vw, 9rem); line-height: 1; margin: 1.4rem 0 .6rem; }

/* ---------------- carta ---------------- */

.carta {
  margin-top: 2rem;
  font-size: 1.25rem;
  line-height: 1.75;
}
.assinatura {
  font-family: var(--nota);
  font-size: 2.8rem;
  color: var(--tinta);
  line-height: 1;
  margin: 1.8rem 0 0;
  transform: rotate(-4deg);
  display: inline-block;
}
.ps {
  margin-top: 2rem;
  font-family: var(--nota);
  color: var(--terracota);
  font-size: 1.9rem;
  line-height: 1.1;
  transform: rotate(-1.5deg);
  max-width: 26ch;
}
.ps b { font-weight: 400; color: var(--tinta); margin-right: .3em; }

/* ---------------- rodapé ---------------- */

.rodape { padding: 3rem 0 3.5rem; text-align: center; }
.fim {
  font-family: var(--livro);
  font-style: italic;
  font-size: 2rem;
  color: var(--tinta);
  margin: 0 0 1.4rem;
}
.colofao { font-family: var(--livro); font-size: 1rem; color: var(--grafite); margin: 0; }
.social { display: flex; justify-content: center; gap: 1.2rem; margin-top: 1.3rem; }
.social a { color: var(--tinta-2); display: inline-flex; transition: transform .2s, color .2s; }
.social a:hover { color: var(--terracota); transform: translateY(-3px); }
.social svg { width: 24px; height: 24px; }

/* ---------------- texto corrido (privacidade) ---------------- */

.texto h2 { font-size: clamp(2rem, 4.5vw, 2.6rem); margin: 2.8rem 0 .6rem; }
.texto .lista { list-style: none; padding: 0; margin: 0 0 1.2rem; }
.texto .lista li { position: relative; padding-left: 1.7rem; margin: .3rem 0; }
.texto .lista li::before {
  content: '';
  position: absolute;
  left: .2rem; top: .78em;
  width: .7rem; height: .18rem;
  background: var(--terracota);
  border-radius: 3px;
  transform: rotate(-8deg);
}
.data-nota { font-family: var(--livro); font-style: italic; color: var(--grafite); }

/* ---------------- formulário ---------------- */

.modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(520px, calc(100vw - 32px));
  width: 100%;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  padding: 20px 6px 10px;
}
.modal::backdrop { background: rgba(31, 22, 12, .5); backdrop-filter: blur(2px); }
.modal[open] { animation: pousar .45s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes pousar {
  from { opacity: 0; transform: translateY(24px) rotate(-3deg); }
  to { opacity: 1; transform: translateY(0) rotate(-.6deg); }
}
.modal-caixa {
  position: relative;
  transform: rotate(-.6deg);
  background-color: var(--papel-claro);
  background-image:
    var(--textura-fibra),
    linear-gradient(to right, transparent 46px, rgba(193, 80, 46, .45) 46px, rgba(193, 80, 46, .45) 47px, transparent 47px);
  padding: 2.2rem 1.8rem 1.8rem 4rem;
  box-shadow: 0 30px 60px -20px rgba(20, 12, 4, .6);
}
.modal h3 { font-size: 2.4rem; }
.modal .sub { font-size: 1.05rem; color: var(--grafite); margin: .4rem 0 1.4rem; }
.modal-fechar {
  position: absolute;
  top: .8rem; right: .9rem;
  width: 36px; height: 36px;
  border: 0;
  background: transparent;
  color: var(--tinta-2);
  cursor: pointer;
  display: grid; place-items: center;
}
.modal-fechar:hover { color: var(--terracota); }
.modal-fechar svg { width: 22px; height: 22px; }

.campo { margin-bottom: 1.1rem; }
.campo label { display: block; font-family: var(--mao); font-weight: 700; font-size: 1.45rem; color: var(--tinta); line-height: 1.1; }
.campo input {
  width: 100%;
  border: 0;
  border-bottom: 2px solid rgba(62, 53, 44, .45);
  background: transparent;
  font-family: var(--corpo);
  font-size: 1.2rem;
  color: var(--tinta);
  padding: .25rem 0 .2rem;
  border-radius: 0;
}
.campo input::placeholder { color: rgba(110, 97, 82, .6); }
.campo input:focus { outline: none; border-bottom-color: var(--terracota); }
.campo input[aria-invalid="true"] { border-bottom-color: var(--coral); }
.aviso { display: block; font-family: var(--nota); color: var(--terracota); font-size: 1.35rem; line-height: 1.1; min-height: 1.1em; }

.consentimento { display: flex; gap: .7rem; align-items: flex-start; font-size: .98rem; line-height: 1.5; margin: .6rem 0 1.5rem; color: var(--tinta-2); }
.consentimento input { accent-color: var(--terracota); width: 1.15rem; height: 1.15rem; margin-top: .25rem; flex: none; }
.modal-estado { font-family: var(--nota); font-size: 1.5rem; color: var(--terracota); line-height: 1.15; margin: 1rem 0 0; min-height: 1em; }

.mel { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------------- revelação ---------------- */

.reveal { opacity: 0; transform: translateY(12px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visivel { opacity: 1; transform: none; }
.ficha.reveal { transform: translateY(18px) rotate(-3deg); }
.ficha.reveal.visivel { transform: rotate(-1.4deg); }
.ficha.reveal:nth-child(2n).visivel { transform: rotate(1.2deg); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .reveal.visivel { opacity: 1; transform: none; transition: none; }
  .escrever .palavra { clip-path: none; opacity: 1; animation: none !important; }
  .risco path { stroke-dashoffset: 0; transition: none; }
  .corrigido::after { transform: rotate(-2deg) scaleX(1); transition: none; }
  .checklist li::after { transform: none; transition: none; }
}

@media (max-width: 560px) {
  body { font-size: 1.08rem; }
  .btn { font-size: 1.5rem; }
  .cabecalho .btn--pequeno { font-size: 1.15rem; padding: .28rem .8rem .36rem; }
  .modal-caixa { padding: 2rem 1.2rem 1.4rem 3rem; background-image: var(--textura-fibra), linear-gradient(to right, transparent 32px, rgba(193, 80, 46, .45) 32px, rgba(193, 80, 46, .45) 33px, transparent 33px); }
}
