/* ---------------------------------------------------------------------------
 * A casca e as pecas comuns a TODAS as paginas -- a inicial e as do FluxCP.
 *
 * O desenho e o da estrutura aprovada em 16/09: cabecalho fixo e translucido,
 * paineis chanfrados, rotulos em Chakra Petch espacados e em caixa alta, um
 * acento so. Cada peca aqui aparece em mais de uma tela; o que e de UMA tela
 * fica na folha dela (site.css, midgard.css).
 *
 * Depende de tokens.css, que vem antes. Nenhuma cor escrita na mao aqui.
 * ------------------------------------------------------------------------- */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--tinta);
  color: var(--texto);
  font-family: var(--corpo);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body { padding-top: var(--topo-altura); }   /* o cabecalho e fixo */

a { color: var(--acento); text-decoration: none; }
a:hover { color: var(--acento-claro); }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
input, select, button, textarea { font: inherit; }
input::placeholder { color: var(--apagado); }

/* ---------- tipos ---------- */
h1, h2, h3 { font-family: var(--titulo); font-weight: 700; margin: 0; text-wrap: balance; }
h1 { font-size: 32px; line-height: 1.1; }
h2 { font-size: 24px; line-height: 1.15; }
h3 { font-size: 20px; font-weight: 600; }
p { margin: 0; }
p + p { margin-top: 12px; }

/* Rotulo de secao: pequeno, espacado, em caixa alta. E o que nomeia um bloco
   nesta linguagem -- no lugar de um titulo grande. */
.rotulo {
  font-family: var(--titulo); font-weight: 700; font-size: 13px;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--sutil);
}
.rotulo-fino {
  font-family: var(--titulo); font-weight: 500; font-size: 12px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--sutil);
}
.rotulo-acento { color: var(--acento); }

.faixa { max-width: var(--larg-max); margin-inline: auto; padding-inline: var(--gutter); }
.faixa-estreita { max-width: var(--larg-texto); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- o chanfro ---------- */
.chanfro { clip-path: polygon(var(--chanfro) 0, 100% 0, 100% calc(100% - var(--chanfro)), calc(100% - var(--chanfro)) 100%, 0 100%, 0 var(--chanfro)); }

/* Painel: a superficie basica. Chanfrado, com borda. */
.painel {
  background: var(--placa);
  border: 1px solid var(--linha);
  clip-path: polygon(var(--chanfro) 0, 100% 0, 100% calc(100% - var(--chanfro)), calc(100% - var(--chanfro)) 100%, 0 100%, 0 var(--chanfro));
}
a.painel, button.painel { color: inherit; text-align: left; cursor: pointer; transition: border-color .2s, background .2s; }
a.painel:hover, button.painel:hover { border-color: var(--acento); background: var(--placa-viva); color: inherit; }

/* Moldura de cantos: quatro cantinhos no acento em volta de uma imagem. */
.moldura { position: relative; padding: 14px; }
.moldura::before, .moldura::after, .moldura > .canto::before, .moldura > .canto::after {
  content: ""; position: absolute; width: 28px; height: 28px;
  border: 0 solid var(--acento);
}
.moldura::before { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.moldura::after { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.moldura > .canto::before { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.moldura > .canto::after { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }
.moldura > .canto { position: absolute; inset: 0; pointer-events: none; }

/* ---------- cabecalho ---------- */
.topo {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  height: var(--topo-altura);
  background: var(--tinta-vidro);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--linha-fraca);
}
.topo-dentro {
  height: 100%; max-width: var(--larg-max); margin-inline: auto; padding-inline: var(--gutter);
  display: flex; align-items: center; gap: 32px;
}
.marca { display: flex; align-items: center; gap: 12px; color: inherit; margin-right: auto; }
.marca:hover { color: inherit; }
.marca-selo {
  width: 34px; height: 34px; flex: none;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: var(--acento); color: var(--sobre-acento);
  display: grid; place-items: center;
  font-family: var(--titulo); font-weight: 700; font-size: 13px;
}
.marca-nome { display: grid; line-height: 1.05; }
.marca-sigla { font-family: var(--titulo); font-weight: 700; font-size: 17px; letter-spacing: 0.04em; }
.marca-longo {
  font-family: var(--titulo); font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--sutil);
}

.menu {
  display: flex; gap: 28px;
  font-family: var(--titulo); font-weight: 600; font-size: 13px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--fraco);
}
.menu a { color: inherit; }
.menu a:hover, .menu a[aria-current="page"] { color: var(--acento); }

.acoes-topo { display: flex; gap: 10px; }

/* ---------- botoes ---------- */
.botao {
  display: inline-flex; align-items: center; justify-content: center;
  height: 52px; padding: 0 28px;
  border: 1px solid var(--acento); background: var(--acento); color: var(--sobre-acento);
  font-family: var(--titulo); font-weight: 700; font-size: 14px;
  letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none;
  cursor: pointer; white-space: nowrap; transition: background .2s, border-color .2s, color .2s;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.botao:hover { background: var(--acento-claro); border-color: var(--acento-claro); color: var(--sobre-acento); }
.botao-vazio { background: transparent; border-color: var(--linha-forte); color: var(--texto); font-weight: 600; }
.botao-vazio:hover { background: transparent; border-color: var(--acento); color: var(--acento); }
.botao-contorno { background: transparent; border-color: var(--acento); color: var(--acento); font-weight: 600; }
.botao-contorno:hover { background: var(--acento-fundo); color: var(--acento); }
.botao-pequeno {
  height: 40px; padding: 0 18px; font-size: 13px; letter-spacing: 0.1em;
  clip-path: polygon(var(--chanfro-botao) 0, 100% 0, 100% calc(100% - var(--chanfro-botao)), calc(100% - var(--chanfro-botao)) 100%, 0 100%, 0 var(--chanfro-botao));
}
.botao-largo { width: 100%; height: 54px; letter-spacing: 0.14em; }
.botao[disabled] { background: var(--placa-alta); border-color: var(--placa-alta); color: var(--apagado); cursor: not-allowed; }

/* ---------- pulso de "ao vivo" ---------- */
.pulso {
  display: inline-flex; align-items: center; gap: 10px; width: fit-content;
  font-family: var(--titulo); font-weight: 600; font-size: 12px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--acento);
}
.pulso::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--acento);
  animation: pulsar 2s ease-out infinite;
}
@keyframes pulsar {
  0%, 100% { box-shadow: 0 0 0 0 var(--acento-halo); }
  70% { box-shadow: 0 0 0 8px var(--acento-sumiu); }
}

/* ---------- celula de numero (status do servidor) ---------- */
.celulas { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.celula { padding: 22px 22px 20px; display: grid; gap: 14px; align-content: start; }
.celula .valor { font-family: var(--titulo); font-weight: 700; font-size: 38px; line-height: 1; }
.celula .valor small { color: var(--sutil); font-size: 22px; font-weight: 700; }
.celula .barra { height: 4px; background: var(--placa-alta); position: relative; overflow: hidden; }
.celula .barra::after { content: ""; position: absolute; inset: 0; width: 100%; background: var(--acento); }

/* ---------- barra de progresso ---------- */
.progresso { height: 4px; background: var(--placa-alta); position: relative; overflow: hidden; }
.progresso > span { position: absolute; inset: 0; background: var(--acento); transition: width .4s ease; }

/* ---------- formularios ---------- */
/* align-content: start -- lado a lado, a grade esticaria as linhas do campo
   mais baixo e o input do vizinho desceria. Foi o que aconteceu com as senhas. */
.campo { display: grid; gap: 8px; align-content: start; }
.campo-rotulo {
  display: flex; justify-content: space-between; gap: 12px;
  font-family: var(--titulo); font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--fraco);
}
.campo-rotulo .dica { color: var(--apagado); letter-spacing: 0; text-transform: none; font-family: var(--corpo); }
.campo-rotulo .dica-ok { color: var(--acento); }
.campo-rotulo .dica-erro { color: var(--alerta); }
.campos { display: grid; gap: 28px; }

/* Grupo de campos: um titulo pequeno com um fio, e os campos embaixo. E o que
   organiza um formulario longo sem virar duas colunas apertadas. */
.grupo { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 18px; }
.grupo-titulo {
  padding: 0; margin-bottom: 16px; width: 100%;   /* legend ignora o gap da grade */
  display: flex; align-items: center; gap: 14px;
  font-family: var(--titulo); font-weight: 600; font-size: 12px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--acento);
}
.grupo-titulo::after { content: ""; flex: 1; height: 1px; background: var(--linha); }
.lado-a-lado { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="search"], select, textarea {
  height: 50px; width: 100%; padding: 0 16px;
  border: 1px solid var(--linha-forte); background: var(--campo); color: var(--texto);
  font-size: 16px; transition: border-color .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--acento); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--acento); width: 18px; height: 18px; }
input[aria-invalid="true"] { border-color: var(--alerta); }

/* Escolha: dois botoes lado a lado (genero). Radios escondidos, rotulo faz o botao. */
.escolhas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.escolha {
  height: 50px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--linha); color: var(--texto-calmo);
  font-family: var(--titulo); font-weight: 600; font-size: 14px;
  letter-spacing: 0.1em; text-transform: uppercase; transition: all .2s;
}
.escolha input { position: absolute; opacity: 0; width: 0; height: 0; }
.escolha:has(input:checked) { border-color: var(--acento); background: var(--acento-fundo); color: var(--acento); }
.escolha:has(input:focus-visible) { outline: 2px solid var(--acento); outline-offset: 2px; }

.medidor { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.medidor span { height: 3px; background: var(--placa-alta); transition: background .3s; }
.medidor[data-nivel="1"] span:nth-child(-n+1),
.medidor[data-nivel="2"] span:nth-child(-n+2),
.medidor[data-nivel="3"] span:nth-child(-n+3),
.medidor[data-nivel="4"] span:nth-child(-n+4) { background: var(--acento); }
.medidor[data-nivel="1"] span:nth-child(1) { background: var(--alerta); }

.aceite { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; line-height: 1.5; color: var(--texto-calmo); cursor: pointer; padding-top: 6px; }
.aceite input { margin-top: 3px; flex: none; }

/* ---------- recados ---------- */
.recado, .message, .red, .important {
  border: 1px solid var(--linha); border-left: 3px solid var(--acento);
  background: var(--placa); padding: 14px 18px; margin-bottom: 20px; font-size: 15px;
}
.red { border-left-color: var(--alerta); color: var(--alerta); }

/* ---------- rodape ---------- */
.rodape { border-top: 1px solid var(--linha-fraca); margin-top: 40px; }
.rodape-dentro {
  max-width: var(--larg-max); margin-inline: auto; padding: 32px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.rodape .aviso { font-size: 13px; color: var(--apagado); max-width: 62ch; margin: 6px 0 0; }
.rodape-links {
  display: flex; gap: 24px;
  font-family: var(--titulo); font-weight: 600; font-size: 12px;
  letter-spacing: 0.14em; text-transform: uppercase;
}
.rodape-links a { color: var(--fraco); }
.rodape-links a:hover { color: var(--acento); }

/* ---------- movimento ---------- */
.sobe { animation: subir .5s ease both; }
@keyframes subir { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* Aparece ao rolar. Visivel por padrao: a classe .escondido so entra por
   JavaScript, entao sem script (ou numa miniatura) tudo esta na tela. */
[data-reveal].escondido { opacity: 0; transform: translateY(16px); }
[data-reveal] { transition: opacity .7s ease, transform .7s ease; }

@media (max-width: 760px) {
  .menu { display: none; }
  .marca-longo { display: none; }
  .topo-dentro { gap: 12px; }
  .acoes-topo { gap: 8px; }
  .botao-pequeno { padding: 0 13px; font-size: 12px; }
  .lado-a-lado { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal].escondido { opacity: 1; transform: none; }
}
