/* ══════════════════════════════════════════════════════════════════════════
   Página pública de status — Mapp Sistemas

   Direção oposta à do painel interno: nada de "sala de controle". Aqui o leitor
   é o cliente, muitas vezes tenso porque algo parou de funcionar. Espaçamento
   generoso, uma frase grande, cor só onde carrega significado.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
  --sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --largura: 720px;
  --r: 12px;
}

:root[data-tema="light"] {
  --bg:        #f7f8fa;
  --superf:    #ffffff;
  --linha:     #e4e7ed;
  --linha-viva:#cdd3dd;

  --txt:       #14171d;
  --txt-suave: #48505f;
  --txt-fraco: #6b7383;

  --ok:        #0a7d57;
  --warn:      #9a6a05;
  --alerta:    #c2560c;
  --bad:       #c62b31;
  --info:      #2b56d4;

  --sombra: 0 1px 2px rgba(16,24,40,.04), 0 4px 14px -6px rgba(16,24,40,.08);
}

:root[data-tema="dark"] {
  --bg:        #0c0e12;
  --superf:    #14171d;
  --linha:     #232833;
  --linha-viva:#333a49;

  --txt:       #eceff5;
  --txt-suave: #a3abbb;
  --txt-fraco: #798294;

  --ok:        #2bd9a0;
  --warn:      #f0b429;
  --alerta:    #ff9142;
  --bad:       #ff5a5f;
  --info:      #6f97ff;

  --sombra: none;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex; flex-direction: column;
  font-family: var(--sans);
  color: var(--txt);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s, color .25s;
}

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

[hidden] { display: none !important; }

/* ── Cabeçalho ──────────────────────────────────────────────────────────── */

/* A barra é a do site institucional: mesmo azul, mesma altura, mesma logo.
   Fica igual nos dois temas de propósito — é identidade de marca, não
   superfície da página. */
.cabecalho { background: #333756; }

.cabecalho__interno {
  max-width: var(--largura); margin: 0 auto;
  height: 68px; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
}

.cabecalho__marca { display: flex; align-items: center; }

.cabecalho__logo {
  height: 40px; width: auto; display: block;
  object-fit: contain;
}

.tema {
  display: grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  color: #ffffffd9; background: transparent;
  border: 1px solid #ffffff33; border-radius: 8px;
  cursor: pointer; transition: color .16s, border-color .16s, background .16s;
}
.tema:hover { color: #fff; border-color: #ffffff66; background: #ffffff14; }
.tema svg {
  width: 16px; height: 16px; fill: none;
  stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
:root[data-tema="dark"]  .icone-sol { display: block; }
:root[data-tema="dark"]  .icone-lua { display: none; }
:root[data-tema="light"] .icone-sol { display: none; }
:root[data-tema="light"] .icone-lua { display: block; }

/* ── Corpo ──────────────────────────────────────────────────────────────── */

.pagina {
  flex: 1;
  width: 100%; max-width: var(--largura);
  margin: 0 auto; padding: 48px 20px 64px;
}

.secao {
  margin: 44px 0 14px;
  font-size: 12px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--txt-fraco);
}

/* ── Resumo: o elemento principal da página ─────────────────────────────── */

.resumo {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  padding: 30px 28px;
  border: 1px solid var(--linha); border-left-width: 4px;
  border-radius: var(--r);
  background: var(--superf);
  box-shadow: var(--sombra);
}

.resumo__sinal {
  width: 12px; height: 12px; margin-top: 9px;
  border-radius: 50%; background: var(--cor, var(--txt-fraco));
  grid-row: span 2;
}

.resumo__frase {
  margin: 0;
  font-size: 23px; font-weight: 600; line-height: 1.3; letter-spacing: -.02em;
}

.resumo__quando {
  margin: 6px 0 0;
  font-size: 13px; color: var(--txt-fraco);
  /* Os dois números mudam a cada segundo; largura fixa de dígito evita o texto
     dançar de um lado para o outro. */
  font-variant-numeric: tabular-nums;
}

/* Segunda metade da linha: informação de apoio, um degrau abaixo na hierarquia.
   O separador é CSS para não entrar no textContent de nenhum dos dois lados —
   e some junto com o texto antes da primeira consulta. */
.resumo__proxima { opacity: .8; }
.resumo__proxima:not(:empty)::before { content: " · "; }

.resumo[data-estado="normal"]       { --cor: var(--ok);     border-left-color: var(--ok); }
.resumo[data-estado="lentidao"]     { --cor: var(--warn);   border-left-color: var(--warn); }
.resumo[data-estado="parcial"]      { --cor: var(--alerta); border-left-color: var(--alerta); }
.resumo[data-estado="indisponivel"] { --cor: var(--bad);    border-left-color: var(--bad); }
.resumo[data-estado="manutencao"]   { --cor: var(--info);   border-left-color: var(--info); }
.resumo[data-estado="carregando"]   { --cor: var(--txt-fraco); border-left-color: var(--linha); }

/* Pulso só quando há problema — chama atenção onde importa. */
.resumo:not([data-estado="normal"]):not([data-estado="carregando"]) .resumo__sinal {
  animation: pulsa 2s ease-in-out infinite;
}
@keyframes pulsa { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ── Comunicados ────────────────────────────────────────────────────────── */

.avisos { margin-top: 20px; display: grid; gap: 14px; }

.aviso {
  padding: 22px 24px;
  border: 1px solid var(--linha); border-radius: var(--r);
  background: var(--superf);
  box-shadow: var(--sombra);
}

.aviso__topo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }

.aviso__selo {
  padding: 4px 10px;
  font-size: 11px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--cor); border: 1px solid var(--cor); border-radius: 100px;
  background: color-mix(in srgb, var(--cor) 10%, transparent);
}
.aviso[data-severidade="lentidao"]     { --cor: var(--warn); }
.aviso[data-severidade="parcial"]      { --cor: var(--alerta); }
.aviso[data-severidade="indisponivel"] { --cor: var(--bad); }
.aviso[data-severidade="manutencao"]   { --cor: var(--info); }

.aviso__titulo { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.015em; }

.aviso__afetados {
  margin: 0; font-size: 13px; color: var(--txt-fraco);
}

/* Linha do tempo: investigando → identificado → resolvido */
.linha-tempo {
  margin: 16px 0 0; padding: 0 0 0 20px;
  list-style: none;
  border-left: 2px solid var(--linha);
  display: grid; gap: 16px;
}
.linha-tempo:empty { display: none; }

.linha-tempo li { position: relative; }
.linha-tempo li::before {
  content: ""; position: absolute;
  left: -26px; top: 6px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--linha-viva);
  box-shadow: 0 0 0 3px var(--superf);
}
.linha-tempo li:last-child::before { background: var(--cor, var(--txt-fraco)); }

.etapa {
  display: block; margin-bottom: 3px;
  font-size: 12px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--txt-fraco);
}
.etapa__texto { margin: 0; font-size: 14px; line-height: 1.6; color: var(--txt-suave); }
.etapa__quando { font-size: 12px; color: var(--txt-fraco); }

/* ── Componentes ────────────────────────────────────────────────────────── */

/* Dois por linha no desktop, um no celular. A lista virou grade porque são 14
   cards: empilhados numa coluna só, o rodapé fica longe demais para quem quer
   uma resposta rápida. */
.componentes {
  margin: 0; padding: 0; list-style: none;
  display: grid; gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.componente {
  display: flex; flex-direction: column;
  padding: 14px 16px;
  border: 1px solid var(--linha); border-radius: var(--r);
  background: var(--superf);
  box-shadow: var(--sombra);
}

.componente__nome {
  margin: 0;
  font-size: 14px; font-weight: 600; line-height: 1.35;
}

.componente__descricao {
  margin: 4px 0 0;
  font-size: 12px; line-height: 1.45; color: var(--txt-fraco);
  /* Empurra a barra para a base: cards de alturas diferentes alinham o
     indicador na mesma linha, e a leitura em varredura funciona. */
  flex: 1;
}

/* Barra no lugar do ponto: 10px de bolinha some numa grade de 14 cards. */
.componente__barra {
  display: block; height: 5px; margin-top: 12px;
  border-radius: 100px;
  background: var(--cor, var(--txt-fraco));
}

.componente__estado {
  margin-top: 6px;
  font-size: 11px; font-weight: 500; letter-spacing: .01em;
  color: var(--cor, var(--txt-fraco));
}

.componente[data-estado="normal"]       { --cor: var(--ok); }
.componente[data-estado="lentidao"]     { --cor: var(--warn); }
.componente[data-estado="parcial"]      { --cor: var(--alerta); }
.componente[data-estado="indisponivel"] { --cor: var(--bad); }
.componente[data-estado="manutencao"]   { --cor: var(--info); }

/* ── Histórico ──────────────────────────────────────────────────────────── */

.historico__item {
  padding: 18px 0;
  border-top: 1px solid var(--linha);
}
.historico__item:first-child { border-top: 0; }

.historico__cabecalho {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  cursor: pointer;
  /* O triângulo padrão do <summary> briga com o layout em flex. */
  list-style: none;
}
.historico__cabecalho::-webkit-details-marker { display: none; }
.historico__cabecalho:hover .historico__titulo { color: var(--info); }

.historico__titulo {
  margin: 0; font-size: 15px; font-weight: 600;
  transition: color .16s;
}
.historico__data { font-size: 13px; color: var(--txt-fraco); }

.historico__resolvido {
  font-size: 12px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; color: var(--ok);
}

.historico__seta {
  width: 16px; height: 16px; margin-left: auto; align-self: center;
  fill: none; stroke: var(--txt-fraco); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform .2s, stroke .16s;
}
.historico__item[open] .historico__seta { transform: rotate(180deg); }
.historico__cabecalho:hover .historico__seta { stroke: var(--txt); }

.historico__texto {
  margin: 8px 0 0;
  font-size: 14px; line-height: 1.6; color: var(--txt-suave);
}

/* Aberto, o resumo vira redundante: a linha do tempo já conta tudo. */
.historico__item[open] .historico__texto { display: none; }

.historico__detalhe {
  --cor: var(--ok);
  margin-top: 14px;
}

.historico__encerramento {
  margin: 14px 0 0;
  font-size: 13px; color: var(--txt-fraco);
}

.historico__vazio {
  margin: 0; padding: 18px 0;
  font-size: 14px; color: var(--txt-fraco);
}

/* ── Erro e rodapé ──────────────────────────────────────────────────────── */

.erro {
  margin-top: 24px; padding: 16px 20px;
  font-size: 14px; color: var(--bad);
  background: color-mix(in srgb, var(--bad) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--bad) 22%, transparent);
  border-radius: var(--r);
}

.rodape {
  border-top: 1px solid var(--linha);
  background: var(--superf);
}
.rodape p {
  max-width: var(--largura); margin: 0 auto;
  padding: 8px 20px;
  font-size: 13px; color: var(--txt-fraco);
}
.rodape p:first-child { padding-top: 22px; }
.rodape p:last-child { padding-bottom: 22px; }
.rodape__marca { font-weight: 500; }

/* ── Responsivo ─────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .cabecalho__interno { height: 58px; padding: 0 16px; }
  .cabecalho__logo { height: 32px; }
  .pagina { padding: 30px 16px 48px; }
  .resumo { padding: 22px 20px; }
  .resumo__frase { font-size: 19px; }
  /* Um card por linha: duas colunas em 360px viram texto ilegível. */
  .componentes { grid-template-columns: 1fr; }
  .aviso { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
