@font-face {
  font-family: "Atkinson";
  src: url("fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url("fonts/caveat-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --nevoa: #e8efea;
  --superficie: #ffffff;
  --tinta: #13231c;
  --tinta-2: #4a5a53;
  --linha: #c9d5cd;
  --pinho: #1d5c45;
  --pinho-escuro: #154635;
  --pinho-claro: #d6e6dc;
  --fita: #c8102e;
  --fita-escura: #a00d25;
  --ouro: #8a6a10;
  --papel: #fffcf4;
  --pauta: #b9cbe6;
  --margem: #e59aa5;
  --caneta: #1f3fa8;

  --r-campo: 10px;
  --r-botao: 10px;
  --sombra-folha: 0 18px 40px rgba(19, 35, 28, 0.18);

  --fs-peq: 0.875rem;
  --fs-corpo: 1.0625rem;
  --fs-h3: 1.25rem;
  --fs-h2: 1.6rem;
  --fs-h1: 2.15rem;

  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--nevoa);
  color: var(--tinta);
  font-family: "Atkinson", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: var(--fs-corpo);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--pinho); }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--fita);
  outline-offset: 2px;
}

h1, h2, h3 { line-height: 1.15; margin: 0; }
h1 { font-size: var(--fs-h1); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-h2); letter-spacing: -0.005em; }
h3 { font-size: var(--fs-h3); }
p { margin: 0; }

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

/* ------------------------------------------------------------ topo */
.topo {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--pinho);
  color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 20px 10px;
}
.topo-dentro {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.marca {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
}
.marca svg { width: 26px; height: 26px; flex: none; }
.topo-eu { border-radius: 50%; display: block; }

/* ------------------------------------------------------------ página */
main {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px 20px calc(64px + env(safe-area-inset-bottom));
}
main:focus { outline: none; }

.voltar {
  display: inline-block;
  font-size: var(--fs-peq);
  font-weight: 700;
  text-decoration: none;
  margin-bottom: 14px;
}

.cabeca { margin-bottom: 22px; }
.cabeca h1 { margin-bottom: 8px; overflow-wrap: anywhere; }
.detalhes { color: var(--tinta-2); display: grid; gap: 2px; }
.detalhes .desc { color: var(--tinta); margin-top: 8px; white-space: pre-line; }

.bloco { margin-top: 34px; }
.bloco > h2 { font-size: var(--fs-h3); margin-bottom: 6px; }
.bloco > .ajuda { color: var(--tinta-2); margin-bottom: 14px; max-width: 60ch; }

.aviso {
  border-left: 4px solid var(--pinho);
  background: var(--superficie);
  padding: 14px 16px;
  border-radius: 0 var(--r-campo) var(--r-campo) 0;
}
.aviso.alerta { border-left-color: var(--fita); }

/* ------------------------------------------------------------ botões */
.btn {
  appearance: none;
  border: 2px solid transparent;
  border-radius: var(--r-botao);
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  background: var(--pinho);
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  transition: background-color 0.15s;
}
.btn:hover { background: var(--pinho-escuro); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn.linha { background: transparent; color: var(--pinho); border-color: var(--pinho); }
.btn.linha:hover { background: var(--pinho-claro); }
.btn.fita { background: var(--fita); }
.btn.fita:hover { background: var(--fita-escura); }
.btn.perigo { background: transparent; color: var(--fita); border-color: var(--fita); }
.btn.perigo:hover { background: #fbe7ea; }
.btn.texto { background: none; color: var(--pinho); padding: 8px 4px; min-height: 40px; }
.btn.texto:hover { text-decoration: underline; background: none; }
.btn.peq { min-height: 40px; padding: 8px 14px; font-size: var(--fs-peq); }
.btn.largo { width: 100%; }
.botoes { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* ------------------------------------------------------------ formulários */
.campo { display: grid; gap: 6px; margin-bottom: 16px; }
.campo > span { font-weight: 700; font-size: var(--fs-peq); }
.campo small { color: var(--tinta-2); font-size: var(--fs-peq); }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="date"], select, textarea {
  width: 100%;
  border: 2px solid var(--linha);
  background: var(--superficie);
  border-radius: var(--r-campo);
  padding: 11px 12px;
  min-height: 48px;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--pinho); outline: none; box-shadow: 0 0 0 3px var(--pinho-claro); }
.marcar { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; cursor: pointer; }
.marcar input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--pinho); flex: none; }
.marcar small { display: block; color: var(--tinta-2); font-size: var(--fs-peq); }

.foto-escolher { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; cursor: pointer; }
.foto-escolher input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.foto-escolher:focus-within .av { outline: 3px solid var(--fita); outline-offset: 2px; }
.foto-escolher b { color: var(--pinho); }

.erro { color: var(--fita-escura); font-weight: 700; margin: -4px 0 14px; }

/* ------------------------------------------------------------ entrar */
.entrar-topo { padding: 28px 0 26px; }
.entrar-topo img { width: 64px; height: 64px; margin-bottom: 18px; border-radius: 14px; }
.entrar-topo h1 { font-size: 2.5rem; margin-bottom: 10px; }
.entrar-topo p { color: var(--tinta-2); max-width: 36ch; }

.seletor {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--pinho-claro);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 22px;
}
.seletor button {
  appearance: none;
  border: 0;
  background: none;
  border-radius: 9px;
  padding: 10px 8px;
  font-weight: 700;
  color: var(--pinho-escuro);
  cursor: pointer;
  min-height: 44px;
}
.seletor button[aria-selected="true"], .seletor a[aria-current="page"] { background: var(--superficie); color: var(--tinta); box-shadow: 0 1px 2px rgba(19, 35, 28, 0.15); }
.seletor a {
  text-align: center;
  border-radius: 9px;
  padding: 10px 8px;
  font-weight: 700;
  color: var(--pinho-escuro);
  text-decoration: none;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.contador {
  background: var(--fita);
  color: #fff;
  border-radius: 999px;
  font-size: 0.75rem;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
}

/* ------------------------------------------------------------ listas */
.lista { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--linha); }
.lista > li { border-bottom: 1px solid var(--linha); }
.linha-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 2px;
  text-decoration: none;
  color: inherit;
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
}
a.linha-item:hover, button.linha-item:hover { background: rgba(255, 255, 255, 0.55); }
button.linha-item { cursor: pointer; }
.linha-item .meio { flex: 1; min-width: 0; }
.linha-item .titulo { font-weight: 700; overflow-wrap: anywhere; }
.linha-item .sub { color: var(--tinta-2); font-size: var(--fs-peq); overflow-wrap: anywhere; }
.linha-item .fim { flex: none; display: flex; gap: 8px; align-items: center; }

.selo {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--pinho-claro);
  color: var(--pinho-escuro);
  white-space: nowrap;
}
.selo.admin { background: #f3e7c2; color: var(--ouro); }
.selo.pendente { background: #fbe7ea; color: var(--fita-escura); }

.vazio { color: var(--tinta-2); padding: 18px 0; }

/* ------------------------------------------------------------ avatar */
.av {
  border-radius: 50%;
  object-fit: cover;
  background: var(--pinho-claro);
  color: var(--pinho-escuro);
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  flex: none;
  overflow: hidden;
}
.topo .av { background: #fff; }

/* ------------------------------------------------------------ mural */
.pessoa-mural { padding: 18px 0 8px; border-bottom: 1px solid var(--linha); }
.pessoa-mural:first-child { padding-top: 6px; }
.pessoa-mural > header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.pessoa-mural > header h3 { flex: 1; font-size: 1.1rem; }
.desejos { list-style: none; margin: 0 0 6px; padding: 0 0 0 54px; }
.desejo { display: flex; gap: 12px; padding: 8px 0; align-items: flex-start; }
.desejo .miniatura { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex: none; background: var(--superficie); }
.desejo .t { font-weight: 700; overflow-wrap: anywhere; }
.desejo .d { color: var(--tinta-2); font-size: var(--fs-peq); white-space: pre-line; overflow-wrap: anywhere; }
.desejo a.link { font-size: var(--fs-peq); font-weight: 700; overflow-wrap: anywhere; }
.desejo .editar { margin-left: auto; }
.pessoa-mural .vazio { padding: 2px 0 10px 54px; font-size: var(--fs-peq); }

/* ------------------------------------------------------------ papelzinho (o momento da revelação) */
.papel-area { margin: 6px 0 8px; }
.papel {
  --h: 104px;
  position: relative;
  display: block;
  width: 100%;
  max-width: 420px;
  height: var(--h);
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  perspective: 1100px;
  transform: rotate(-1.4deg);
  transition: height 0.75s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.papel[aria-expanded="true"] { height: calc(var(--h) * 2); cursor: default; }
.papel:focus-visible { outline-offset: 6px; }

.metade {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--h);
  background-color: var(--papel);
  background-image:
    linear-gradient(90deg, transparent 40px, var(--margem) 40px, var(--margem) 42px, transparent 42px),
    repeating-linear-gradient(180deg, transparent 0 25px, var(--pauta) 25px 26px);
}
.metade.cima {
  top: 0;
  border-radius: 3px 3px 0 0;
  box-shadow: 0 2px 10px rgba(19, 35, 28, 0.12);
  display: flex;
  align-items: flex-end;
  padding: 0 18px 10px 56px;
}
.papel-rotulo { font-family: "Caveat", cursive; font-size: 1.7rem; color: var(--caneta); line-height: 1; }

.metade.baixo {
  top: var(--h);
  transform-origin: top center;
  transform: rotateX(180deg);
  transform-style: preserve-3d;
  transition: transform 0.75s cubic-bezier(0.2, 0.8, 0.2, 1);
  background: none;
}
.papel[aria-expanded="true"] .metade.baixo { transform: rotateX(0deg); }

.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.face.frente {
  background-color: var(--papel);
  background-image:
    linear-gradient(180deg, rgba(19, 35, 28, 0.10), transparent 14px),
    linear-gradient(90deg, transparent 40px, var(--margem) 40px, var(--margem) 42px, transparent 42px),
    repeating-linear-gradient(180deg, transparent 0 25px, var(--pauta) 25px 26px);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 10px 18px rgba(19, 35, 28, 0.14);
  display: flex;
  align-items: flex-start;
  padding: 4px 18px 0 56px;
}
.papel-nome {
  font-family: "Caveat", cursive;
  font-size: 3.1rem;
  line-height: 1.1;
  color: var(--caneta);
  overflow-wrap: anywhere;
  text-align: left;
}
.face.verso {
  transform: rotateX(180deg);
  background: #f6f1e3;
  border-radius: 3px;
  box-shadow: var(--sombra-folha);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 20px;
  color: var(--tinta);
}
.face.verso .lacre {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--fita);
  display: grid;
  place-items: center;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
  flex: none;
}
.face.verso .lacre svg { width: 24px; height: 24px; }
.face.verso b { font-size: 1.1rem; }
.face.verso small { display: block; color: var(--tinta-2); font-size: var(--fs-peq); font-weight: 400; }

.revelado { margin-top: 26px; }
.revelado > header { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.revelado .desejos { padding-left: 0; }

@media (prefers-reduced-motion: reduce) {
  .papel, .metade.baixo { transition: none; }
}

/* ------------------------------------------------------------ admin */
.convite-link {
  font-size: var(--fs-peq);
  background: var(--superficie);
  border: 2px dashed var(--linha);
  border-radius: var(--r-campo);
  padding: 10px 12px;
  overflow-wrap: anywhere;
  user-select: all;
}
.par-select { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.par-select span { color: var(--tinta-2); font-weight: 700; }

/* ------------------------------------------------------------ folha (diálogo) */
dialog.folha {
  border: 0;
  padding: 0;
  width: min(560px, 100%);
  max-height: 92vh;
  margin: auto auto 0;
  border-radius: 18px 18px 0 0;
  background: var(--nevoa);
  color: var(--tinta);
  box-shadow: var(--sombra-folha);
}
@media (min-width: 640px) {
  dialog.folha { margin: auto; border-radius: 18px; }
}
dialog.folha::backdrop { background: rgba(19, 35, 28, 0.45); }
.folha-corpo { padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); }
.folha-corpo > h2 { font-size: var(--fs-h3); margin-bottom: 14px; padding-right: 40px; }
.folha-corpo > p { color: var(--tinta-2); margin-bottom: 8px; }
.folha-fechar {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--superficie);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.previa { width: 96px; height: 96px; border-radius: 10px; object-fit: cover; }

/* ------------------------------------------------------------ toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translate(-50%, 140%);
  background: var(--tinta);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  max-width: calc(100% - 32px);
  width: max-content;
  z-index: 50;
  visibility: hidden;
  transition: transform 0.25s, visibility 0s linear 0.25s;
  font-weight: 700;
}
#toast.ver { transform: translate(-50%, 0); visibility: visible; transition: transform 0.25s; }
#toast.ruim { background: var(--fita-escura); }

.carregando { color: var(--tinta-2); padding: 40px 0; }

.btn.arquivo { position: relative; cursor: pointer; }
.btn.arquivo input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.btn.arquivo:focus-within { outline: 3px solid var(--fita); outline-offset: 2px; }
