/* ─────────────────────────────────────────────────────────────────────────
   PDV PRO · app (Capacitor/Android)
   1) Tela de abertura (/app/): logo se desenhando, brilho e escolha do perfil.
   2) Modo aplicativo em todas as páginas (html.app-modo, ligado por app-modo.js):
      transições suaves entre páginas, barra de carregamento e "Carregando…" animado.
   Fora do app, só a página /app/ usa estas regras.
   ───────────────────────────────────────────────────────────────────────── */

/* ── 1. Abertura ────────────────────────────────────────────────────────── */
body.app-inicio {
  margin: 0; min-height: 100vh; min-height: 100dvh; overflow: hidden;
  background: #0b0b0d; color: #f2f2f4;
  font-family: 'Archivo', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.app-inicio .tema-alternar, body.app-inicio .wa-float { display: none !important; }
body.app-inicio .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.abertura {
  position: fixed; inset: 0; display: grid; place-items: center; align-content: center; gap: 22px;
  padding: env(safe-area-inset-top) 24px env(safe-area-inset-bottom);
  transition: opacity .55s cubic-bezier(.21, .61, .35, 1), transform .55s cubic-bezier(.21, .61, .35, 1);
}
.abertura.sai { opacity: 0; transform: scale(1.06); pointer-events: none; }

/* brilho que respira atrás da logo */
.ab-brilho {
  position: absolute; width: 72vmin; height: 72vmin; border-radius: 50%;
  background: radial-gradient(closest-side, rgb(138 107 255 / .42), rgb(74 43 194 / .14) 55%, transparent 72%);
  filter: blur(6px); opacity: 0;
  animation: ab-brilho 2.6s cubic-bezier(.21, .61, .35, 1) .15s forwards, ab-respira 3.2s ease-in-out 2.75s infinite;
}
@keyframes ab-brilho { from { opacity: 0; transform: scale(.55); } to { opacity: 1; transform: scale(1); } }
@keyframes ab-respira { 50% { transform: scale(1.08); opacity: .82; } }

/* logo: moldura cresce, o miolo aparece e os dois "P" se desenham */
.ab-logo { position: relative; width: 112px; height: 112px; overflow: visible; }
.ab-logo .moldura { transform-origin: 128px 128px; transform: scale(.4) rotate(-12deg); opacity: 0;
  animation: ab-moldura .8s cubic-bezier(.2, 1.4, .4, 1) .2s forwards; }
.ab-logo .miolo { transform-origin: 128px 128px; transform: scale(.6); opacity: 0;
  animation: ab-miolo .5s cubic-bezier(.21, .61, .35, 1) .55s forwards; }
.ab-logo .traco { stroke-dasharray: 260; stroke-dashoffset: 260; animation: ab-traco .75s cubic-bezier(.65, 0, .35, 1) forwards; }
.ab-logo .traco.p1 { animation-delay: .8s; }
.ab-logo .traco.p2 { animation-delay: 1s; }
@keyframes ab-moldura { to { transform: none; opacity: 1; } }
@keyframes ab-miolo { to { transform: none; opacity: 1; } }
@keyframes ab-traco { to { stroke-dashoffset: 0; } }

/* nome: letras sobem uma a uma */
.ab-nome { position: relative; display: grid; justify-items: center; gap: 6px; }
.ab-nome .letras { display: flex; font-family: 'Archivo', system-ui, sans-serif; font-stretch: 78%; font-weight: 800;
  font-size: 2rem; letter-spacing: .02em; overflow: hidden; padding: 0 2px; }
.ab-nome .letras span { display: inline-block; transform: translateY(110%); animation: ab-letra .55s cubic-bezier(.2, .9, .3, 1) forwards; }
.ab-nome small { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: .7rem; letter-spacing: .38em; text-transform: uppercase;
  color: rgb(242 242 244 / .62); opacity: 0; animation: ab-aparece .6s ease 1.65s forwards; }
@keyframes ab-letra { to { transform: none; } }
@keyframes ab-aparece { to { opacity: 1; } }

/* carregamento: trilho fino com um brilho correndo */
.ab-carga { position: relative; width: 132px; height: 2px; border-radius: 2px; overflow: hidden;
  background: rgb(255 255 255 / .1); opacity: 0; animation: ab-aparece .4s ease 1.5s forwards; }
.ab-carga i { position: absolute; inset: 0 auto 0 -40%; width: 40%; border-radius: 2px;
  background: linear-gradient(90deg, transparent, #a48af7, #fff, #a48af7, transparent);
  animation: ab-corre 1.1s cubic-bezier(.45, 0, .2, 1) infinite; }
@keyframes ab-corre { to { left: 100%; } }

/* escolha do perfil (quem ainda não entrou) */
.escolha {
  position: fixed; inset: 0; overflow-y: auto; display: grid; align-content: center; gap: 14px;
  padding: calc(28px + env(safe-area-inset-top)) 22px calc(28px + env(safe-area-inset-bottom));
  max-width: 460px; margin: 0 auto;
}
.escolha[hidden] { display: none; }
.escolha .topo { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.escolha .topo img { width: 44px; height: 44px; }
.escolha .topo b { display: block; font-stretch: 80%; font-size: 1.25rem; }
.escolha .topo small { font-family: 'IBM Plex Mono', monospace; font-size: .66rem; letter-spacing: .22em; text-transform: uppercase; color: rgb(242 242 244 / .6); }
.escolha h1 { margin: 6px 0 4px; font-stretch: 80%; font-size: 1.9rem; line-height: 1.05; color: #fff !important; }
.escolha :is(b, .topo b) { color: #f6f6f8 !important; }
.escolha p.sub { margin: 0 0 8px; color: rgb(242 242 244 / .7); }
.perfil {
  display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 14px;
  padding: 16px; border-radius: 6px; text-decoration: none; color: inherit;
  background: rgb(255 255 255 / .045); border: 1px solid rgb(255 255 255 / .09);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: transform .3s cubic-bezier(.21, .61, .35, 1), border-color .3s, background .3s;
  opacity: 0; transform: translateY(16px); animation: ab-sobe .6s cubic-bezier(.21, .61, .35, 1) forwards;
}
.perfil:nth-of-type(1) { animation-delay: .05s; } .perfil:nth-of-type(2) { animation-delay: .15s; } .perfil:nth-of-type(3) { animation-delay: .25s; }
.perfil:active { transform: scale(.98); }
.perfil:hover { border-color: rgb(164 138 247 / .5); background: rgb(164 138 247 / .08); }
.perfil .ic { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 6px;
  background: rgb(164 138 247 / .12); border: 1px solid rgb(164 138 247 / .35); color: #c9b9ff; font-size: 1.3rem; }
.perfil b { display: block; font-size: 1.02rem; }
.perfil small { color: rgb(242 242 244 / .66); }
.perfil .seta { color: rgb(242 242 244 / .45); font-size: 1.3rem; }
.escolha .entrar { margin-top: 6px; text-align: center; color: rgb(242 242 244 / .7); font-size: .92rem; opacity: 0; animation: ab-aparece .5s ease .45s forwards; }
.escolha .entrar a { color: #c9b9ff; }
@keyframes ab-sobe { to { opacity: 1; transform: none; } }

/* ── 2. Modo aplicativo em todas as páginas ─────────────────────────────── */
/* transição suave entre páginas: a antiga some e a nova sobe de leve */
::view-transition-old(root) { animation: app-vt-sai .28s cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: app-vt-entra .38s cubic-bezier(.21, .61, .35, 1) both; }
@keyframes app-vt-sai { to { opacity: 0; transform: scale(.985); } }
@keyframes app-vt-entra { from { opacity: 0; transform: translateY(10px); } }

/* entrada do conteúdo quando o navegador não faz a transição entre páginas */
/* no <body> só a opacidade: um transform ali quebraria os elementos fixos (menu, janelas, botão do WhatsApp) */
html.app-modo body:not(.app-inicio) { animation: app-surge .42s cubic-bezier(.21, .61, .35, 1) backwards; }
@keyframes app-surge { from { opacity: 0; } }
@keyframes app-entra { from { opacity: 0; transform: translateY(8px); } }
html.app-modo .conteudo > * { animation: app-entra .38s cubic-bezier(.21, .61, .35, 1) backwards; }

/* barra de carregamento no topo ao navegar */
.app-barra { position: fixed; z-index: 100000; top: 0; left: 0; right: 0; height: 3px; pointer-events: none; opacity: 0; overflow: hidden; }
.app-barra.ativa { opacity: 1; }
.app-barra::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 45%;
  background: linear-gradient(90deg, transparent, rgb(var(--m-accent-rgb, 164 138 247)), #fff, rgb(var(--m-accent-rgb, 164 138 247)), transparent);
  box-shadow: 0 0 12px rgb(var(--m-accent-rgb, 164 138 247) / .8);
  animation: app-barra 1s cubic-bezier(.45, 0, .2, 1) infinite;
}
@keyframes app-barra { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* "Carregando…" dos painéis: anel girando com a cor de destaque e texto com brilho */
html.app-modo .carregando {
  display: grid; justify-items: center; gap: 14px; padding: 56px 0; text-align: center;
  font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: .74rem; letter-spacing: .22em; text-transform: uppercase;
  background: linear-gradient(90deg, var(--m-soft, #999) 35%, var(--m-text, #fff) 50%, var(--m-soft, #999) 65%) 0 0 / 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: app-brilho-texto 1.6s linear infinite;
}
html.app-modo .carregando::before {
  content: ""; width: 38px; height: 38px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 20%, rgb(var(--m-accent-rgb, 164 138 247)) 70%, #fff 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  animation: app-gira .8s linear infinite;
}
@keyframes app-gira { to { transform: rotate(1turn); } }
@keyframes app-brilho-texto { to { background-position: -300% 0; } }

/* áreas seguras do celular (entalhe e barra de gestos) */
html.app-modo body { padding-bottom: env(safe-area-inset-bottom); }
html.app-modo .topbar, html.app-modo .topo-mobile { padding-top: env(safe-area-inset-top); }

/* ── 3. Baixar o app (página /app/baixar.html e botões do site) ─────────── */
.icon-download { --icone: url('../img/lucide/download.svg'); }
.icon-smartphone { --icone: url('../img/lucide/smartphone.svg'); }
[data-baixar-app][hidden] { display: none !important; }
html.app-modo [data-baixar-app] { display: none !important; }      /* dentro do app não oferece baixar o app */

.pagina-baixar .baixar { display: grid; gap: 16px; max-width: 760px; padding-top: 28px; padding-bottom: 48px; }
.pagina-baixar .baixar-nav { display: flex; gap: 8px; }
.pagina-baixar .baixar-cab h1 { margin: 10px 0 8px; }
.baixar-perfis { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.baixar-perfis li { display: flex; gap: 12px; align-items: flex-start; }
.baixar-perfis .site-icon { color: var(--m-accent, #a48af7); font-size: 1.2rem; margin-top: 2px; }
.baixar-perfis b { display: block; }
.baixar-acao h2 { margin: 0 0 12px; }
.baixar-btn { display: inline-flex; align-items: center; gap: 8px; }
.baixar-detalhes { margin: 10px 0 0; font-family: var(--m-f-mono, monospace); font-size: .74rem; letter-spacing: .06em; color: var(--m-soft, #aaa); }
.baixar-passos { margin: 18px 0 0; padding-left: 1.3em; display: grid; gap: 10px; line-height: 1.5; }
.baixar-nota { margin: 16px 0 0; font-size: .9rem; color: var(--m-soft, #aaa); }
.baixar-hash { margin-top: 16px; font-size: .8rem; color: var(--m-soft, #aaa); }
.baixar-hash code { display: block; margin-top: 6px; word-break: break-all; font-size: .72rem; }
.baixar-qr { display: flex; flex-wrap: wrap; gap: 22px; align-items: center; }
.baixar-qr img { background: #fff; padding: 8px; border-radius: 4px; }
.baixar-qr > div { flex: 1 1 240px; }
.baixar-url { font-family: var(--m-f-mono, monospace); font-size: .9rem; }

.baixar-lista { display: grid; gap: 12px; }
.baixar-item { display: grid !important; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.baixar-item > .site-icon { font-size: 1.8rem; color: var(--m-accent, #a48af7); }
.baixar-item h2 { margin: 4px 0; font-size: 1.25rem; }
.baixar-item p { margin: 0; }
@media (max-width: 560px) { .baixar-item { grid-template-columns: auto 1fr; } .baixar-item .btn { grid-column: 1 / -1; } }

@media (prefers-reduced-motion: reduce) {
  .abertura *, .escolha *, .perfil, .app-barra::before, html.app-modo body, html.app-modo .conteudo > *,
  html.app-modo .carregando, html.app-modo .carregando::before { animation-duration: .01s !important; animation-iteration-count: 1 !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
