/* =====================================================================
   CONTROL METRICS — BASE.CSS
   Estilos globais, variáveis, tipografia, botões, header e footer.
   Carregado em: index.html, about/, portal/, admin/
   ===================================================================== */

:root {
  --bg: #070b1a;
  --ink: #eef2ff;
  --mute: #b8c2e4;
  --line: #26315f;
  --accent: #22d3ee;
  --accent2: #8b5cf6;
  --on-accent: #fff;
  --panel: #0f1736;
  --grad: linear-gradient(135deg, #22d3ee, #4f6bff 50%, #9b5cf6);
  color-scheme: dark;
  box-sizing: border-box;
}

html {
  scroll-padding-top: 0px;
  scroll-behavior: smooth;
  background: var(--bg);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(900px 520px at 88% -4%, rgba(99, 102, 241, .38), transparent 62%),
              radial-gradient(700px 460px at -6% 18%, rgba(34, 211, 238, .20), transparent 60%),
              var(--bg);
  color: var(--ink);
  font: 400 18px/1.6 "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

/* ─── TIPOGRAFIA ─── */
h1, h2, h3 {
  font-family: Jost, "Century Gothic", "Avenir Next", sans-serif;
  font-weight: 600;
  line-height: 1.08;
  margin: 0;
  letter-spacing: -.01em;
}
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: 1.4rem; }
p { margin: 0; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ─── LAYOUT BASE ─── */
.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── HEADER ─── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 11, 26, .72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  max-width: 1160px;
  margin: 0 auto;
}

.logo {
  display: block;
  height: auto;
  width: min(300px, 52vw);
}

nav {
  display: flex;
  gap: 28px;
  align-items: center;
  font-weight: 500;
  font-size: 16px;
}

nav a {
  text-decoration: none;
  white-space: nowrap;
}

nav a:hover {
  text-decoration: underline;
  text-underline-offset: 5px;
}

/* ─── BOTÕES ─── */
.btn {
  display: inline-block;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  color: #fff;
  font: 600 17px/1 Jost, sans-serif;
  padding: 16px 26px;
  text-decoration: none;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  box-shadow: 0 8px 28px -8px rgba(99, 102, 241, .8);
  transition: transform .2s, filter .2s;
}

.btn:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.btn.ghost {
  background: rgba(255, 255, 255, .05);
  border: 1px solid #3a4780;
  box-shadow: none;
  color: var(--ink);
}

.btn.ghost:hover {
  background: rgba(79, 107, 255, .16);
  border-color: #4f6bff;
}

.btn.danger {
  background: #7f1d1d;
  box-shadow: none;
}
.btn.danger:hover {
  background: #991b1b;
}

/* Botões específicos de login do header */
.login {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #3a4780;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s ease, border-color .2s ease;
}
.login:hover {
  background: rgba(79, 107, 255, .16);
  border-color: #4f6bff;
  text-decoration: none;
}

/* ─── FOOTER ─── */
footer {
  background: rgba(5, 8, 20, .65);
  border-top: 1px solid var(--line);
  padding: 28px 0;
  font-size: 15px;
  color: var(--mute);
  margin-top: auto;
}

footer .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ─── UTILITÁRIOS E TOAST ─── */
[hidden] {
  display: none !important;
}

.ops-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: 90vw;
  background: #0f1736;
  border: 1px solid #3a4780;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .7);
}
.ops-toast.bad {
  border-color: #b91c1c;
  color: #fecaca;
}

/* Ajustes de responsividade básicos */
@media (max-width: 1040px) {
  nav a:not(.btn):not(.login) { display: none; }
  .bar { gap: 10px; padding: 12px 20px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
}

/* ─── CORREÇÃO DO MENU MOBILE/DESKTOP ─── */
.burger { display: none; }
.menu { display: none; }

@media (max-width: 1040px) {
  .burger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid #3a4780;
    background: rgba(255, 255, 255, .06);
    cursor: pointer;
    padding: 0;
  }
  .burger span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
    transition: transform .25s ease, opacity .2s ease;
  }
  header.open .burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  header.open .burger span:nth-child(2) { opacity: 0; }
  header.open .burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .bar nav { margin-left: auto; }
  
  .menu {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: rgba(7, 11, 26, .97);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    padding: 6px 20px 22px;
    box-shadow: 0 30px 50px -20px rgba(0, 0, 0, .6);
  }
  header.open .menu { display: block; }
  
  .menu a:not(.btn) {
    display: block;
    padding: 17px 4px;
    font: 500 19px "Instrument Sans", system-ui, sans-serif;
    text-decoration: none;
    border-bottom: 1px solid var(--line);
  }
  .menu .login {
    border: 0;
    border-radius: 0;
    padding: 17px 4px;
    font: 500 19px "Instrument Sans", system-ui, sans-serif;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 12px;
    background: none;
  }
  .menu .btn {
    display: block;
    text-align: center;
    margin-top: 18px;
  }
}

/* ─── BOTÃO VOLTAR AO TOPO (SCROLL PROGRESS) ─── */
.totop {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: #fff;
  display: grid;
  place-items: center;
  background: rgba(14, 20, 48, .72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 32px -8px rgba(79, 107, 255, .65), inset 0 0 0 1px rgba(255, 255, 255, .14);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(.9);
  transition: opacity .3s ease, transform .3s ease, visibility .3s, box-shadow .25s ease;
}

.totop.show {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.totop:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 38px -8px rgba(124, 92, 246, .85), inset 0 0 0 1px rgba(255, 255, 255, .28);
}

.totop .ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.totop .ring circle {
  fill: none;
  stroke-width: 3;
}

.totop .trk {
  stroke: rgba(255, 255, 255, .12);
}

.totop .prg {
  stroke: url(#tg);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset .15s linear;
}

.totop .arr {
  position: relative;
  transition: transform .25s ease;
}

.totop:hover .arr {
  transform: translateY(-2px);
}

@media (max-width: 760px) {
  .totop {
    right: 16px;
    bottom: 16px;
    width: 50px;
    height: 50px;
  }
}