/* Tecnocafé · base: reset, tipografia, texturas da saca e a moldura do app. */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  /* O foco do teclado não fica atrás das abas nem do rodapé fixo (2.4.11): --fixo-alt vem de js/ui/fixo.js. */
  --fixo-base: calc(var(--abas) + env(safe-area-inset-bottom));
  scroll-padding-bottom: calc(var(--fixo-alt, var(--fixo-base)) + 24px);
}
html:has(body.com-pilula) { --fixo-base: calc(var(--abas) + 72px + env(safe-area-inset-bottom)); }
html:has(body.sem-abas) { --fixo-base: env(safe-area-inset-bottom); }
:root[data-texto="maior"] { font-size: 120%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
svg { overflow: visible; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--cherry); outline-offset: 3px; border-radius: 4px; }
.juta :focus-visible, .sobre-juta :focus-visible { outline-color: var(--ink); }

.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: fixed; left: 8px; top: -80px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 10px; text-decoration: none; font-weight: 700;
}
.pular:focus { top: 8px; }

/* Texturas e elementos da saca */
.juta {
  background-color: var(--sack);
  background-image:
    repeating-linear-gradient(0deg, var(--weave-a) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, var(--weave-b) 0 1.5px, transparent 1.5px 4px),
    repeating-linear-gradient(90deg, var(--weave-a) 0 1px, transparent 1px 7px);
  color: var(--ink);
}
.fio { display: grid; gap: 4px; }
.fio::before, .fio::after { content: ""; height: 2px; border-radius: 1px; }
.fio::before { background: var(--cherry); }
.fio::after { background: var(--leaf); }
.costura { height: 0; border: 0; border-top: 2px dashed var(--rule); margin: 0; }
.bainha { height: 16px; border-top: 2px dashed var(--weave-a); background: rgba(43, 33, 25, .06); }

.num, .carimbo {
  font-family: var(--f-stamp);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.rotulo-carimbo {
  font-family: var(--f-stamp);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}
:root[data-numeros="simples"] .num,
:root[data-numeros="simples"] .carimbo,
:root[data-numeros="simples"] .rotulo-carimbo { font-weight: 700; letter-spacing: 0; }

.titulo-tela {
  font-family: var(--f-display);
  font-stretch: 115%;
  font-weight: 800;
  font-size: 1.75rem;
  line-height: 1.05;
  letter-spacing: -.005em;
}
.wm { font-family: var(--f-display); font-stretch: 125%; font-weight: 800; letter-spacing: .015em; line-height: .92; }
.wm b { color: var(--cherry); font-weight: inherit; }
.suave { color: var(--ink-soft); }

/* Moldura do app */
#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
#conteudo { flex: 1; display: flex; flex-direction: column; outline: none; }
.tela {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 var(--gutter) calc(var(--abas) + 32px + env(safe-area-inset-bottom));
  animation: surge .12s ease-out both;
}
.tela.sem-abas { padding-bottom: 32px; }
@keyframes surge { from { opacity: 0; } to { opacity: 1; } }

.abas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--card);
  border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}
.abas a {
  display: grid; justify-items: center; align-content: center; gap: 3px;
  min-height: 56px; padding: 6px 4px;
  text-decoration: none; color: var(--ink-soft);
  font-size: .75rem; font-weight: 600;
}
.abas a svg { width: 24px; height: 24px; }
.abas a[aria-current="page"] { color: var(--leaf); }
.abas a[aria-current="page"] span { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
body.guiado .abas, body.sem-abas .abas { display: none; }
/* Enquanto o boot decide a rota não há aba para tocar. */
body.iniciando .abas { display: none; }

@media (min-width: 900px) {
  /* A barra tem a largura da coluna de conteúdo (560 px). */
  .abas { left: 50%; right: auto; width: min(560px, 100%); transform: translateX(-50%); border: 1px solid var(--rule); border-bottom: 0; border-radius: 16px 16px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
:root[data-movimento="reduzido"] *, :root[data-movimento="reduzido"] *::before, :root[data-movimento="reduzido"] *::after {
  animation: none !important; transition: none !important;
}

/* Títulos recebem foco a cada troca de tela, sem anel (não são controles). */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus, p[tabindex="-1"]:focus, main:focus, .folha:focus { outline: none; }
