/* =========================================================
   Guia Visual da Obra · shell do app (PWA)
   Mesmo mundo das fichas: kraft, tinta chapada, Archivo.
   Base 390 px, uma mão, sol forte: alvos >= 48 px, contraste alto.
   ========================================================= */

:root {
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --topo: env(safe-area-inset-top, 0px);
  --pe: env(safe-area-inset-bottom, 0px);
  --coluna: 640px;
  --cor: var(--tinta);          /* cor da tela atual (pacote/módulo) */
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  background: var(--kraft);
  scrollbar-color: var(--kraft-escuro) var(--kraft);
}
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--kraft);
  color: var(--tinta);
  font-family: var(--fonte);
  font-size: var(--t-corpo);
  line-height: var(--entrelinha);
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--atencao); color: var(--tinta); }
:focus-visible { outline: 3px solid var(--atencao); outline-offset: 2px; }
h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a, button, input { touch-action: manipulation; }
a, button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
svg { flex: none; }
[hidden] { display: none !important; }
.sprite { overflow: hidden; }
.so-leitor {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.pular {
  position: absolute; left: 8px; top: -100px; z-index: 50;
  background: var(--atencao); color: var(--tinta); padding: 12px 16px; font-weight: 800;
}
.pular:focus { top: calc(var(--topo) + 8px); }

main { flex: 1 0 auto; width: 100%; outline: none; }
.miolo { max-width: var(--coluna); margin: 0 auto; }
/* faixas de cor sangram a tela; o conteúdo fica na coluna */
.marca, .capa, .barra { --lado: max(var(--gutter), calc((100% - var(--coluna)) / 2 + var(--gutter))); }

/* rótulo em caixa alta, como na ficha */
.rot {
  font-stretch: var(--w-condensada);
  font-weight: 800;
  font-size: var(--t-rotulo);
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* listras do saco (duas linhas no pé de uma faixa de cor) */
.listras { position: relative; }
.listras::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 8px;
  height: 6px;
  border-top: 2px solid rgba(255,255,255,.7);
  border-bottom: 2px solid rgba(255,255,255,.7);
  pointer-events: none;
}

/* =========================================================
   MARCA (topo do Início): frente do saco, em tinta
   ========================================================= */
.marca {
  background: var(--tinta);
  color: #fff;
  padding: calc(var(--topo) + 20px) var(--lado) 40px;
}
.marca__nome {
  font-stretch: var(--w-espremida);
  font-weight: 900;
  font-size: clamp(3.4rem, 17vw, 5rem);
  line-height: .84;
  letter-spacing: -.005em;
  text-transform: uppercase;
}
.marca__nome span { display: block; }
.marca__nome .marca__obra { color: var(--kraft); }
.marca__sub {
  margin-top: 14px;
  color: var(--kraft-claro);
  font-stretch: var(--w-condensada);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
}

/* =========================================================
   BARRA (telas internas)
   ========================================================= */
.barra {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s2);
  min-height: 56px;
  padding: var(--topo) calc(var(--lado) - 8px) 0;
  background: var(--cor);
  color: #fff;
}
.barra__voltar {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 48px; min-width: 48px;
  padding: 0 12px 0 8px;
  border-radius: var(--canto);
  font-stretch: var(--w-condensada); font-weight: 800; font-size: 1.0625rem;
  transition: background-color 120ms ease, transform 120ms var(--ease-out);
}
.barra__voltar svg { width: 26px; height: 26px; }
.barra__voltar:active { background: rgba(255,255,255,.16); transform: scale(.97); }
.barra__titulo {
  flex: 1; min-width: 0;
  padding-right: 12px;
  text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-stretch: var(--w-condensada); font-weight: 700;
  font-size: var(--t-rotulo); letter-spacing: .08em; text-transform: uppercase;
  opacity: .92;
}

/* =========================================================
   BUSCA
   ========================================================= */
.busca {
  position: relative;
  width: 100%; max-width: var(--coluna); margin: 0 auto;
  padding: var(--s4) var(--gutter);
  box-sizing: border-box;
}
.busca.e-fixa {
  position: sticky; top: calc(var(--topo) + 56px); z-index: 15;
  background: var(--kraft);
  max-width: none;
  padding-left: max(var(--gutter), calc((100% - var(--coluna)) / 2 + var(--gutter)));
  padding-right: max(var(--gutter), calc((100% - var(--coluna)) / 2 + var(--gutter)));
  border-bottom: var(--fio) solid rgba(31,26,20,.18);
}
.busca__campo {
  display: flex; align-items: center; gap: 10px;
  min-height: 60px;
  padding: 0 52px 0 14px;
  background: var(--papel);
  border: var(--fio-medio) solid var(--tinta);
  border-radius: var(--canto);
  cursor: text;
}
.busca__campo:focus-within { box-shadow: 0 0 0 3px var(--atencao); }
.busca__campo svg { width: 26px; height: 26px; color: var(--tinta); }
.busca__campo input {
  flex: 1; min-width: 0;
  height: 56px;
  border: 0; outline: 0; background: transparent;
  color: var(--tinta);
  font: inherit;
  font-size: 1.1875rem;           /* 19 px: nunca abaixo de 16 (zoom no iPhone) */
  font-weight: 600;
  caret-color: var(--passo);
  -webkit-appearance: none; appearance: none;
}
.busca__campo input::placeholder { color: var(--tinta-2); font-weight: 500; opacity: 1; }
.busca__campo input::-webkit-search-cancel-button { display: none; }
.busca__limpar {
  position: absolute; top: 50%; right: calc(var(--gutter) + 4px);
  translate: 0 -50%;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: var(--canto);
}
.busca.e-fixa .busca__limpar { right: max(calc(var(--gutter) + 4px), calc((100% - var(--coluna)) / 2 + var(--gutter) + 4px)); }
.busca__limpar svg { width: 24px; height: 24px; }
.busca__limpar:active { background: var(--kraft-claro); }

/* =========================================================
   SEÇÕES DO INÍCIO
   ========================================================= */
.secao { padding: 0 var(--gutter); margin-top: var(--s6); }
.secao:first-child { margin-top: 0; }
.secao__cab {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3);
  margin-bottom: var(--s3);
}
.secao__titulo {
  font-stretch: var(--w-condensada);
  font-weight: 800;
  font-size: var(--t-h2);
  line-height: 1.1;
}
.secao__conta {
  font-stretch: var(--w-condensada); font-weight: 700;
  font-size: var(--t-rotulo); letter-spacing: .08em; text-transform: uppercase;
  color: var(--kraft-escuro);
}
.secao__nota { margin: -4px 0 var(--s3); font-size: var(--t-menor); color: var(--tinta); }

/* linha-atalho (continuar, favoritos) em painel de papel */
.atalhos { display: grid; gap: var(--s2); padding: 0 var(--gutter); }
.atalho {
  display: grid; grid-template-columns: 56px 1fr 24px; align-items: center; gap: var(--s3);
  min-height: 72px;
  padding: 8px 12px 8px 8px;
  background: var(--papel);
  border: var(--fio-medio) solid var(--tinta);
  border-radius: var(--canto);
  transition: transform 120ms var(--ease-out), background-color 120ms ease;
}
.atalho:active { transform: scale(.98); background: var(--kraft-claro); }
.atalho__selo {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  background: var(--cor);
  color: #fff;
  border-radius: 2px;
  font-stretch: var(--w-espremida); font-weight: 900; font-size: 1.25rem; line-height: 1;
}
.atalho__selo svg { width: 30px; height: 30px; }
.atalho__selo--estrela { background: var(--atencao); color: var(--tinta); }
.atalho__texto { min-width: 0; }
.atalho__rot { display: block; color: var(--tinta-2); }
.atalho__nome {
  display: block;
  font-stretch: var(--w-condensada); font-weight: 800; font-size: 1.1875rem; line-height: 1.15;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.atalho > svg { width: 24px; height: 24px; color: var(--tinta-2); }

/* grade de pacotes: cada um é a frente de um saco na cor do pacote */
.pacotes { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.pacote {
  --cor: var(--tinta);
  display: flex; flex-direction: column;
  min-height: 148px;
  padding: 12px 12px 26px;
  background: var(--cor);
  color: #fff;
  border-radius: var(--canto);
  overflow: hidden;
  transition: transform 120ms var(--ease-out), filter 120ms ease;
}
.pacote:active { transform: scale(.97); filter: brightness(.9); }
.pacote__topo { display: flex; justify-content: space-between; align-items: flex-start; }
.pacote__num {
  font-stretch: var(--w-espremida); font-weight: 900;
  font-size: 3.25rem; line-height: .82; letter-spacing: -.01em;
}
.pacote__topo svg { width: 30px; height: 30px; margin-top: 2px; }
.pacote__nome {
  margin-top: auto; padding-top: 12px;
  font-stretch: var(--w-condensada); font-weight: 800;
  font-size: 1.125rem; line-height: 1.08;
  text-wrap: balance;
}
.pacote__conta {
  margin-top: 4px;
  font-stretch: var(--w-condensada); font-weight: 700;
  font-size: var(--t-rotulo); letter-spacing: .08em; text-transform: uppercase;
  opacity: .9;
}
.pacotes > .pacote:last-child:nth-child(odd) { grid-column: 1 / -1; min-height: 120px; }

/* instalar */
.instalar {
  margin: var(--s6) var(--gutter) 0;
  padding: var(--s4);
  background: var(--kraft-claro);
  border-radius: var(--canto);
}
.instalar__titulo { font-stretch: var(--w-condensada); font-weight: 800; font-size: 1.25rem; line-height: 1.15; }
.instalar__texto { margin-top: 6px; font-size: var(--t-menor); line-height: 1.4; }
.instalar__texto svg { width: 20px; height: 20px; vertical-align: -4px; }
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; width: 100%;
  margin-top: var(--s3);
  padding: 0 20px;
  background: var(--tinta); color: #fff;
  border-radius: var(--canto);
  font-stretch: var(--w-condensada); font-weight: 800; font-size: 1.1875rem;
  transition: transform 120ms var(--ease-out), background-color 120ms ease;
}
.botao svg { width: 24px; height: 24px; }
.botao:active { transform: scale(.97); background: #000; }

/* =========================================================
   CABEÇALHO DE PACOTE / MÓDULO (igual à faixa da ficha)
   ========================================================= */
.capa {
  background: var(--cor);
  color: #fff;
  padding: 4px var(--lado) 40px;
}
.capa__topo {
  display: flex; align-items: center; gap: var(--s2);
  font-stretch: var(--w-condensada); font-weight: 700;
  font-size: var(--t-rotulo); letter-spacing: .07em; text-transform: uppercase;
}
.capa__topo svg { width: 26px; height: 26px; }
.capa__codigo {
  display: block; margin-top: 14px;
  font-stretch: var(--w-espremida); font-weight: 900;
  font-size: var(--t-codigo); line-height: .82; letter-spacing: -.01em;
}
.capa__nome {
  display: block; margin-top: 12px;
  font-stretch: var(--w-condensada); font-weight: 800;
  font-size: var(--t-titulo); line-height: 1.02;
  text-wrap: balance;
}

/* =========================================================
   LISTA DE FICHAS (painel de papel)
   ========================================================= */
.lista { background: var(--papel); }
.lista--solta { margin: 0 var(--gutter); border: var(--fio-medio) solid var(--tinta); border-radius: var(--canto); }
.item {
  --cor: var(--tinta);
  display: grid; grid-template-columns: 4.1rem 1fr 22px; gap: var(--s3); align-items: start;
  min-height: 72px;
  padding: 14px var(--gutter);
  border-bottom: var(--fio) solid var(--linha);
  transition: background-color 120ms ease;
}
.lista--solta .item { padding-left: 12px; padding-right: 12px; }
.item:last-child { border-bottom: 0; }
.item:active { background: var(--kraft-claro); }
.item__codigo {
  color: var(--cor);
  font-stretch: var(--w-espremida); font-weight: 900;
  font-size: 2rem; line-height: .9; letter-spacing: -.01em;
  padding-top: 2px;
  white-space: nowrap;
}
.item__texto { min-width: 0; }
.item__nome {
  display: block;
  font-stretch: var(--w-condensada); font-weight: 800;
  font-size: 1.1875rem; line-height: 1.15;
  text-wrap: pretty;
}
.item__nome .fav { width: 16px; height: 16px; margin-left: 6px; vertical-align: -1px; color: var(--tinta); fill: var(--atencao); }
.item__desc {
  display: block; margin-top: 4px;
  font-size: var(--t-menor); line-height: 1.38; color: var(--tinta-2);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.item__trecho {
  display: block; margin-top: 6px;
  font-size: var(--t-menor); line-height: 1.4; color: var(--tinta);
}
.item__onde { display: block; margin-top: 4px; color: var(--tinta-2); font-size: var(--t-mini); }
.item > svg { width: 22px; height: 22px; margin-top: 6px; color: var(--tinta-2); }
mark { background: var(--atencao-fundo); color: var(--tinta); font-weight: 700; box-shadow: inset 0 -3px 0 var(--atencao); padding: 0 1px; }

/* =========================================================
   BUSCA: resultados e estado vazio
   ========================================================= */
.resultado-cab {
  padding: 0 var(--gutter) var(--s3);
  font-stretch: var(--w-condensada); font-weight: 700;
  font-size: var(--t-rotulo); letter-spacing: .08em; text-transform: uppercase;
  color: var(--kraft-escuro);
}
.vazio { padding: var(--s5) var(--gutter) 0; }
.vazio__titulo { font-stretch: var(--w-condensada); font-weight: 800; font-size: 1.5rem; line-height: 1.12; text-wrap: balance; }
.vazio__texto { margin-top: 8px; font-size: 1.0625rem; line-height: 1.45; max-width: 34em; }
.vazio__texto svg { width: 22px; height: 22px; vertical-align: -4px; color: var(--tinta); fill: var(--atencao); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }
.chip {
  display: inline-flex; align-items: center;
  min-height: 48px; padding: 0 16px;
  background: var(--papel);
  border: var(--fio-medio) solid var(--tinta);
  border-radius: var(--canto);
  font-stretch: var(--w-condensada); font-weight: 800; font-size: 1.125rem;
  transition: transform 120ms var(--ease-out), background-color 120ms ease;
}
.chip:active { transform: scale(.96); background: var(--kraft-claro); }

/* =========================================================
   RODAPÉ, OFFLINE, AVISO FLUTUANTE
   ========================================================= */
.rodape {
  width: 100%; max-width: var(--coluna); margin: var(--s7) auto 0;
  box-sizing: border-box;
  padding: 0 var(--gutter) calc(var(--pe) + 72px);
}
.rodape__aviso {
  display: grid; grid-template-columns: 26px 1fr; gap: var(--s3); align-items: center;
  padding: var(--s3) var(--s4);
  background: var(--papel);
  border: var(--fio-medio) solid var(--tinta);
  border-radius: var(--canto);
  font-weight: 700; font-size: var(--t-menor); line-height: 1.35;
}
.rodape__aviso svg { width: 26px; height: 26px; }
.rodape__fontes { margin-top: var(--s3); font-size: var(--t-menor); font-weight: 600; }
.rodape__lote {
  margin-top: var(--s3);
  font-stretch: var(--w-espremida); font-weight: 600;
  font-size: var(--t-mini); letter-spacing: .14em; text-transform: uppercase;
  color: var(--jato);
}

.offline {
  position: fixed; z-index: 30;
  left: 50%; bottom: calc(var(--pe) + 12px);
  translate: -50% 0;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 10px;
  background: var(--jato); color: #fff;
  border-radius: 999px;
  white-space: nowrap;
  font-stretch: var(--w-condensada); font-weight: 700;
  font-size: var(--t-rotulo); letter-spacing: .06em; text-transform: uppercase;
  pointer-events: none;
}
.offline svg { width: 18px; height: 18px; }

.aviso-flutuante {
  position: fixed; z-index: 40;
  left: var(--gutter); right: var(--gutter);
  bottom: calc(var(--pe) + 60px);
  max-width: calc(var(--coluna) - 2 * var(--gutter)); margin: 0 auto;
  display: flex; align-items: center; gap: var(--s3);
  min-height: 56px;
  padding: 6px 6px 6px 16px;
  box-sizing: border-box;
  background: var(--tinta); color: #fff;
  border-radius: var(--canto);
  box-shadow: 0 2px 4px rgba(31,26,20,.2), 0 10px 28px rgba(31,26,20,.28);
  font-weight: 700; font-size: 1rem; line-height: 1.3;
  opacity: 0; transform: translateY(16px);
  visibility: hidden;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out), visibility 0s linear 200ms;
}
.aviso-flutuante.e-visivel {
  opacity: 1; transform: none; visibility: visible;
  transition: opacity 260ms var(--ease-out), transform 260ms var(--ease-out), visibility 0s;
}
.aviso-flutuante__texto { flex: 1; }
.aviso-flutuante__acao {
  min-height: 48px; padding: 0 16px;
  background: var(--atencao); color: var(--tinta);
  border-radius: 2px;
  font-stretch: var(--w-condensada); font-weight: 800; font-size: 1.0625rem;
  white-space: nowrap;
}
.aviso-flutuante__acao:active { transform: scale(.97); }
.aviso-flutuante--ok .aviso-flutuante__texto::before {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 10px;
  background: var(--conferir-fundo); border-radius: 2px; vertical-align: -1px;
  box-shadow: inset 0 0 0 3px var(--conferir);
}
.sem-js { padding: 24px var(--gutter); font-weight: 700; }

/* títulos de página e complementos */
.pagina-titulo {
  padding: var(--s5) var(--gutter) var(--s2);
  font-stretch: var(--w-condensada); font-weight: 800;
  font-size: var(--t-titulo); line-height: 1.02;
}
.vazio--colado { padding-top: var(--s2); }
.vazio .botao { width: auto; margin-top: var(--s5); }
.lista--proximo { margin-top: var(--s5); border-top: var(--fio-medio) solid var(--tinta); border-bottom: var(--fio-medio) solid var(--tinta); }
.lista--proximo .item { align-items: center; }
.lista--proximo .item__onde { margin: 0 0 2px; }
.atalho__selo--estrela svg { fill: var(--tinta); }
@media (hover: hover) and (pointer: fine) {
  .item:hover, .atalho:hover { background: var(--kraft-claro); }
  .chip:hover { background: var(--kraft-claro); }
  .pacote:hover { filter: brightness(1.08); }
  .barra__voltar:hover { background: rgba(255,255,255,.12); }
  .botao:hover { background: #000; }
}

/* tela larga: coluna central sobre kraft */
@media (min-width: 700px) {
  .pacotes { grid-template-columns: repeat(3, 1fr); }
  .pacotes > .pacote:last-child:nth-child(odd) { grid-column: auto; min-height: 148px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-property: opacity, background-color, filter, visibility !important; }
  .aviso-flutuante { transform: none; }
}
