/* Tokens visuais do design (Meca 3D Lab Monitor) — verbatim dos dois .dc.html */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #0b0d0f;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  color: #e8ecef;
  -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #2a3038; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3a424c; }
::-webkit-scrollbar-track { background: transparent; }
button, input { font-family: inherit; }

@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: .28; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ring { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(2.6); opacity: 0; } }
@keyframes sweepx { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes beat { 0%, 72%, 100% { transform: scale(1); } 12% { transform: scale(1.32); } 26% { transform: scale(1); } }
@keyframes gridpan { from { background-position: 0 0; } to { background-position: 44px 44px; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

html { scroll-behavior: smooth; }
a { text-decoration: none; }

/* Telas de app com viewport fixo (gerador, painel): nav no topo + linha sidebar/main. */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: radial-gradient(1300px 900px at 80% -12%, #12181e, #0b0d0f 62%);
}

/* Páginas roláveis (home, estáticas): a página cresce e rola normalmente.
   NÃO usar overflow-x aqui — quebra o position:sticky da nav do topo. */
.page {
  min-height: 100vh;
  width: 100%;
  background: radial-gradient(1300px 900px at 80% -12%, #12181e, #0b0d0f 62%);
}

/* ═══════════════════════════════════════════════════════════════════════
   SITE 2.0 — Fase 1: tokens formalizados + classes de interação
   (Elevação visual. Valores = os atuais do site, agora como custom properties.
   As classes são CONSUMIDAS pelas fases seguintes; nada existente muda.)
   ═══════════════════════════════════════════════════════════════════════ */
:root {
  /* superfícies */
  --bg: #0b0d0f;
  --bg-radial: radial-gradient(1300px 900px at 80% -12%, #12181e, #0b0d0f 62%);
  --card: linear-gradient(180deg, #15191e, #111418);
  --card-border: rgba(255,255,255,.06);
  --card-border-hover: rgba(255,255,255,.11);
  --card-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 26px -20px rgba(0,0,0,.95);
  --card-shadow-hover: 0 1px 0 rgba(255,255,255,.04) inset, 0 18px 40px -22px rgba(0,0,0,.98);

  /* texto (piso 11px — nada menor; ver a11y abaixo) */
  --text: #e8ecef;
  --text-strong: #eef2f4;
  --text-mid: #9aa3ac;
  --text-dim: #8a939c;
  --text-faint: #6b7580;   /* só em >=12px */

  /* acento */
  --accent: #5fd39b;
  --accent-soft: rgba(95,211,155,.09);
  --accent-border: rgba(95,211,155,.24);
  --accent-glow: 0 14px 34px -12px rgba(95,211,155,.6);
  --accent-glow-strong: 0 16px 40px -12px rgba(95,211,155,.72);

  /* acentos de widget (manter exatamente) */
  --w-blue: #5fb8ff; --w-green: #8fd15a; --w-purple: #c98bff;
  --w-cyan: #5fd0c8; --w-pink: #ff7b9c;  --w-yellow: #f5c451;
  --w-orange: #f5934f; --w-red: #ff6b6b; --w-sky: #54b6f0;

  /* tipografia / forma */
  --font-ui: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --r-card: 14px; --r-btn: 12px; --r-pill: 30px;

  /* transições e foco (novos) */
  --ease: cubic-bezier(.2,.7,.3,1);
  --t-fast: 140ms; --t-med: 220ms;
  --focus-ring: 0 0 0 2px #0b0d0f, 0 0 0 4px rgba(95,211,155,.7);
}

/* Firefox scrollbar (hoje só há -webkit-) */
html { scrollbar-width: thin; scrollbar-color: #2a3038 transparent; }

/* Foco visível universal (acessibilidade — substitui o outline:none seco) */
a:focus-visible, button:focus-visible, input:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 8px;
}

/* Ícone inline: alinhamento vertical consistente */
.ico { display: inline-flex; align-items: center; justify-content: center; flex: none; }

/* ---- Botões ---- */
.btn-primary {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 14px 24px; border: none; border-radius: var(--r-btn);
  font: 650 15.5px/1 var(--font-ui); color: #0b0d0f; background: var(--accent);
  box-shadow: var(--accent-glow); cursor: pointer;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--accent-glow-strong); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 20px; border-radius: var(--r-btn);
  font: 600 14.5px/1 var(--font-ui); color: #cdd3d8;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1);
  cursor: pointer; transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.btn-ghost:hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.16); }

/* ---- Links de nav ---- */
.nav-link {
  padding: 8px 12px; border-radius: 9px; font: 500 13px/1 var(--font-ui);
  color: var(--text-mid); transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.nav-link:hover { color: var(--text-strong); background: rgba(255,255,255,.05); }
.nav-link.is-active { color: var(--text-strong); background: var(--accent-soft); font-weight: 600; }

/* ---- Cards ---- */
.card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--r-card); box-shadow: var(--card-shadow);
}
/* card clicável (comunidade): sobe no hover */
.card-link { cursor: pointer; transition: transform var(--t-med) var(--ease), border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease); }
.card-link:hover { transform: translateY(-2px); border-color: var(--card-border-hover); box-shadow: var(--card-shadow-hover); }
/* card NÃO clicável (demo): só realça a borda, sem sugerir clique */
.card-static { transition: border-color var(--t-med) var(--ease); }
.card-static:hover { border-color: var(--card-border-hover); }

/* ---- Busca ---- */
.search-box { transition: border-color var(--t-fast) var(--ease); }
.search-box:focus-within { border-color: var(--accent-border); box-shadow: 0 0 0 3px rgba(95,211,155,.12); }

/* ---- Pill toggle PT|EN (Fase 3, já deixo pronta) ---- */
.lang-toggle { display: inline-flex; border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-pill); overflow: hidden; font: 600 11px/1 var(--font-mono); }
.lang-toggle button, .lang-toggle .lang-opt { display: inline-flex; align-items: center; padding: 6px 10px; background: transparent; border: none; color: var(--text-dim); cursor: pointer; text-decoration: none; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.lang-toggle button.is-active, .lang-toggle .lang-opt.is-active { background: var(--accent-soft); color: var(--accent); }
.lang-toggle button:hover:not(.is-active), .lang-toggle .lang-opt:hover:not(.is-active) { color: var(--text-strong); }

/* ---- Interface IoT (mestre-detalhe) ---- */
.iot-item { transition: background var(--t-fast) var(--ease); }
.iot-item:hover { background: rgba(255,255,255,.035); }
.iot-chip { transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.iot-chip:hover { border-color: rgba(95,211,155,.35) !important; color: #eef2f4 !important; }
.iot-specs > .iot-cell:nth-child(odd) { border-right: 1px solid rgba(255,255,255,.05); }
@media (max-width: 820px) {
  .iot-layout { flex-direction: column; }
  .iot-rail { width: 100% !important; position: static !important; max-height: 300px !important; }
  .iot-specs { grid-template-columns: 1fr !important; }
  .iot-specs > .iot-cell:nth-child(odd) { border-right: none; }
}

/* ---- Nav responsiva (Fase 3): desktop inline + menu hamburger no mobile ---- */
.nav-header { flex: none; position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 13px clamp(14px,4vw,34px); border-bottom: 1px solid var(--card-border); background: rgba(11,14,17,.82); backdrop-filter: blur(12px); }
.nav-cluster { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: flex-end; flex-wrap: wrap; }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-mobile { display: none; align-items: center; gap: 6px; }
.nav-hamb { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: none; background: transparent; color: #cdd3d8; cursor: pointer; border-radius: 10px; transition: background var(--t-fast) var(--ease); }
.nav-hamb:hover { background: rgba(255,255,255,.05); }
.nav-panel { display: none; flex-basis: 100%; order: 99; flex-direction: column; gap: 8px; padding: 6px 2px 2px; }
.nav-panel.is-open { display: flex; animation: rise .2s var(--ease); }
.nav-panel .nav-link { font-size: 14px; padding: 11px 12px; }
@media (max-width: 900px) { .nav-cluster { display: none; } .nav-mobile { display: flex; } }
@media (min-width: 901px) { .nav-panel { display: none !important; } }

/* Acessibilidade: respeitar quem pediu menos movimento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}
