/* ==========================================================================
   SDR Automotivo - sistema visual
   Referência: nasa.gov / spacex.com - tipografia forte sobre preto, rótulos
   em mono caixa alta, hairlines, raio zero, um único acento de cor.
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #000000;
  --bg-2: #0b0b0c;
  --bg-3: #131315;
  --rule: rgba(255, 255, 255, 0.14);
  --rule-strong: rgba(255, 255, 255, 0.32);
  --rule-input: rgba(255, 255, 255, 0.42);
  --text-1: #ffffff;
  --text-2: #b9b9bb;
  --text-3: #8c8c8c;
  --accent: #f64137;         /* marcadores e alertas (nunca como fundo de texto) */
  --accent-btn: #c62e25;     /* fundo de botão: branco sobre ele = 5,5:1 */
  --accent-btn-hover: #b8261d;
  --ok: #ffffff;
  --warn: #8c8c8c;
  --font-head: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Public Sans', 'Inter', Arial, sans-serif;
  --font-mono: 'DM Mono', 'SFMono-Regular', Consolas, monospace;
  --gutter: clamp(20px, 5vw, 72px);
  --btn-outline-bg: rgba(0, 0, 0, .5);
  --grid-line: rgba(255, 255, 255, .05);   /* grade de fundo (login, 404) */
  --topbar-h: 72px;                        /* altura do cabeçalho das páginas públicas */
}

/* Modo claro - mesmos tokens, invertidos; acionado por :root[data-theme="light"] via JS (botão de tema) */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-2: #f4f4f5;
  --bg-3: #e9e9ea;
  --rule: rgba(0, 0, 0, 0.12);
  --rule-strong: rgba(0, 0, 0, 0.32);
  --rule-input: rgba(0, 0, 0, 0.46);  /* borda de campo: 3,7:1 sobre o branco */
  --text-1: #0a0a0a;
  --text-2: #46464a;
  --text-3: #6b6b6f;
  --accent: #c62e25;                  /* no claro o acento também é texto (índices de seção): 5,5:1 sobre o branco */
  --ok: #0a0a0a;
  --warn: #6b6b6f;
  --btn-outline-bg: rgba(0, 0, 0, .04);
  --grid-line: rgba(0, 0, 0, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text-1); font-family: var(--font-body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; transition: background .2s, color .2s; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.1; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--text-1); outline-offset: 3px; }

/* Rótulo mono (NASA: 11.2px, caixa alta, tracking 3.5px) */
.label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--text-2); }

/* Barra superior estática (não fixa) */
.topbar { display: flex; justify-content: space-between; align-items: center; height: 72px; padding: 0 var(--gutter); border-bottom: 1px solid var(--rule); background: var(--bg); }
.wordmark { font-family: var(--font-mono); font-size: 13px; letter-spacing: .34em; text-transform: uppercase; white-space: nowrap; }
/* Marca: símbolo S + "SDR" + "Automotivo" */
.wordmark.marca { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-head); letter-spacing: normal; text-transform: none; color: var(--text-1); }
.marca-simbolo { width: 23px; height: 25px; flex: none; }
.marca-texto { display: flex; flex-direction: column; line-height: 1; }
.marca-nome { font-weight: 700; font-size: 18px; letter-spacing: -.045em; }
.marca-sub { margin-top: 3px; font-family: var(--font-mono); font-size: 8.5px; letter-spacing: .32em; text-transform: uppercase; opacity: .72; }
.topbar nav { display: flex; gap: 34px; align-items: center; }
.topbar nav a { font-family: var(--font-mono); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--text-2); transition: color .2s; white-space: nowrap; }
.topbar nav a:hover { color: var(--text-1); }
.topbar nav a.nav-cta { color: var(--text-1); border: 1px solid var(--rule-strong); height: 34px; padding: 0 16px; display: inline-flex; align-items: center; line-height: 16px; transition: color .2s, border-color .2s; }
.topbar nav a.nav-cta:hover { border-color: var(--text-1); }

/* Cabeçalho das páginas públicas (landing, login, 404): uma linha só em qualquer largura.
   O painel usa .topbar.app e não é afetado. O que some em cada largura é decidido por classe:
   .nav-sec (links de seção) abaixo de 1024px; .nav-home abaixo de 640px. */
.topbar.site { height: var(--topbar-h); padding: 0 var(--page-x, var(--gutter)); flex-wrap: nowrap; gap: 24px; }
.topbar.site .wordmark { padding: 12px 0; }   /* área de toque de 44px; a altura do cabeçalho é fixa, o desenho não muda */
.topbar.site nav { gap: 28px; flex-wrap: nowrap; }
.topbar.site nav a:not(.nav-cta) { padding: 12px 0; line-height: 16px; }
.topbar.site .theme-toggle { min-width: 130px; line-height: 16px; } /* mesma linha de base do botão vizinho */
.nav-cta .short { display: none; }
@media (max-width: 1179px) {
  .topbar.site nav { gap: 14px; }
}
@media (max-width: 1023px) {
  .topbar.site nav a.nav-sec { display: none; }
}
@media (max-width: 639px) {
  :root { --topbar-h: 64px; }
  .topbar.site { gap: 16px; }
  .topbar.site nav a.nav-home { display: none; }
  .topbar.site nav a.nav-cta { height: 40px; }
  .topbar.site .theme-toggle { height: 40px; }
  .nav-cta .full { display: none; }
  .nav-cta .short { display: inline; }
}
@media (max-width: 359px) {
  /* telas de 320px: marca e botão mais compactos para caberem na mesma linha */
  .topbar.site .wordmark { letter-spacing: .2em; }
  .topbar.site .theme-toggle { min-width: 0; padding: 0 10px; letter-spacing: .14em; }
}

/* Grade de fundo das páginas públicas (login, 404): linhas de 64 em 64px contadas a partir do canto
   inferior esquerdo do texto. As horizontais atravessam a área; as verticais começam na margem do texto.
   Nenhuma linha fica a menos de 24px de uma borda paralela (sem hairline dobrada). */
.grid-area { position: relative; overflow: hidden; }
.grid-area > * { position: relative; z-index: 1; }
.grid-area::before, .grid-area::after { content: ""; position: absolute; z-index: 0; pointer-events: none; }
.grid-area::before { left: 0; right: 0; bottom: 0; height: 100%; height: round(down, calc(100% - 24px), 64px); background: linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 100% 64px; }
.grid-area::after { top: 0; bottom: 0; left: var(--page-x, var(--gutter)); width: calc(100% - var(--page-x, var(--gutter))); width: round(down, calc(100% - var(--page-x, var(--gutter)) + 40px), 64px); background: linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 64px 100%; }

/* Link "pular para o conteúdo": só aparece ao receber foco pelo teclado */
.skip { position: absolute; left: var(--gutter); top: 0; z-index: 10; height: var(--topbar-h); display: flex; align-items: center; padding: 0 18px; transform: translateY(-110%); background: var(--text-1); color: var(--bg); font-family: var(--font-mono); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; white-space: nowrap; }
.skip:focus { transform: none; outline-offset: -5px; outline-color: var(--bg); }

/* Botões - quadrados, sem sombra */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 46px; padding: 0 22px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .22em; text-transform: uppercase; border: 1px solid transparent; cursor: pointer; background: transparent; transition: background .2s, border-color .2s, color .2s; white-space: nowrap; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent-btn); color: #ffffff; border-color: var(--accent-btn); }
.btn-primary:hover { background: var(--accent-btn-hover); border-color: var(--accent-btn-hover); }
.btn-outline { border-color: var(--rule-strong); color: var(--text-1); background: var(--btn-outline-bg); }
.btn-outline:hover { border-color: var(--text-1); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { color: var(--text-1); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 11px; }

/* Alternância de tema (claro/escuro) */
.theme-toggle { border: 1px solid var(--rule-strong); color: var(--text-2); }
.theme-toggle:hover { border-color: var(--text-1); color: var(--text-1); }

/* Formulários */
.input { width: 100%; height: 46px; background: var(--bg-2); border: 1px solid var(--rule-input); padding: 0 14px; font-family: var(--font-body); font-size: 15px; outline: none; transition: border-color .2s; border-radius: 0; -webkit-appearance: none; appearance: none; }
textarea.input { height: auto; padding: 12px 14px; line-height: 1.5; resize: vertical; }
select.input { padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 18px) center, calc(100% - 13px) center; background-size: 5px 5px; background-repeat: no-repeat; }
select.input option { background: var(--bg-3); }
.input:focus { border-color: var(--text-1); }
.input:focus-visible { outline: 2px solid var(--text-1); outline-offset: -1px; } /* anel de 2px exatos: cobre a borda de 1px e soma 1px por fora */
.input::placeholder { color: var(--text-3); }
.field label { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--text-2); margin-bottom: 8px; }
.field .desc { font-size: 13px; color: var(--text-3); margin: -2px 0 8px; font-weight: 300; }

/* Revelação por scroll - só esconde quando o JS está ativo (html.js); sem JS o conteúdo aparece normalmente */
.js [data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .7s cubic-bezier(.2, .7, .2, 1); }
.js [data-reveal][data-delay="1"] { transition-delay: .1s; }
.js [data-reveal][data-delay="2"] { transition-delay: .2s; }
.js [data-reveal][data-delay="3"] { transition-delay: .3s; }
.js [data-reveal][data-delay="4"] { transition-delay: .4s; }
.js [data-reveal].in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

@media (max-width: 800px) {
  .topbar { height: auto; padding: 16px var(--gutter); flex-wrap: wrap; gap: 14px; }
  .topbar nav { gap: 18px; flex-wrap: wrap; }
  .input { font-size: 16px; } /* evita o zoom automático do iOS ao focar */
}
