/* ==========================================================================
   FICHA DE DIREÇÃO DE ARTE DO SISTEMA (GERADA SOB MEDIDA — ZERO PADRÃO IA)
   1. Arquétipo & Polaridade: [Optical Obsidian & Machined Hardware — Dark Titanium]
   2. Matizes OKLCH:          [--hue-brand: 222 (Cyan-Azure 1D) | --hue-neutral: 232]
   3. Trio Tipográfico:       [Space Grotesk + Plus Jakarta Sans + JetBrains Mono]
   4. Família de Raios:       [Técnico de Precisão: Outer 10px / Control 6px / Inner 4px]
   5. Assinatura Autoral:     [Grade Suíça 1px + Cruzetas Ópticas (+) + Telemetria 3D]
   6. Sequência Topológica:   [Split Hero 3D -> Telemetry Strip -> Bento 7:5 -> Workbench -> Hairline Matrix -> Vitrine Ledger]
   7. Engenharia do Nível:    [Nível 3: Robô IA Articulado + Dupla Hélice DNA InstancedMesh + FOV 32 + PBR RoomEnv + Raycaster]
   ========================================================================== */

:root {
  color-scheme: dark;

  --hue-brand: 222;
  --hue-neutral: 232;

  /* 1. SUPERFÍCIES POR ELEVAÇÃO LUMINOSA (60% — 30%) */
  --bg-canvas:    oklch(0.128 0.008 var(--hue-neutral));
  --bg-surface-1: oklch(0.164 0.010 var(--hue-neutral));
  --bg-surface-2: oklch(0.200 0.012 var(--hue-neutral));
  --bg-floating:  oklch(0.235 0.014 var(--hue-neutral));
  --bg-glass:     oklch(0.155 0.011 var(--hue-neutral) / 0.84);

  /* 2. BORDAS ARQUITETURAIS DE 1PX E LUZ ZENITAL */
  --border-subtle:  oklch(0.96 0.006 var(--hue-neutral) / 0.075);
  --border-default: oklch(0.96 0.006 var(--hue-neutral) / 0.125);
  --border-strong:  oklch(0.96 0.006 var(--hue-neutral) / 0.230);
  --specular-top:   inset 0 1px 0 0 oklch(1 0 0 / 0.085);

  /* 3. HIERARQUIA TIPOGRÁFICA DE ALTA NITIDEZ (8%) */
  --fg-primary:   oklch(0.970 0.005 var(--hue-neutral));
  --fg-secondary: oklch(0.755 0.012 var(--hue-neutral));
  --fg-muted:     oklch(0.575 0.012 var(--hue-neutral));
  --fg-on-accent: oklch(0.132 0.018 var(--hue-neutral));

  /* 4. ACENTO PRIMÁRIO CIRÚRGICO ÚNICO (2% DA TELA) */
  --accent-primary:       oklch(0.765 0.158 var(--hue-brand));
  --accent-primary-hover: oklch(0.822 0.150 216);
  --accent-subtle-bg:     oklch(0.765 0.158 var(--hue-brand) / 0.11);
  --accent-subtle-border: oklch(0.765 0.158 var(--hue-brand) / 0.32);

  /* 5. SEMÂNTICA OPERACIONAL */
  --status-ok-bg:   oklch(0.72 0.15 154 / 0.12);
  --status-ok-fg:   oklch(0.81 0.14 154);
  --status-ok-bd:   oklch(0.72 0.15 154 / 0.28);
  --status-warn-bg: oklch(0.78 0.15 76 / 0.12);
  --status-warn-fg: oklch(0.84 0.14 76);
  --status-warn-bd: oklch(0.78 0.15 76 / 0.28);
  --status-err-bg:  oklch(0.64 0.19 25 / 0.13);
  --status-err-fg:  oklch(0.77 0.16 25);
  --status-err-bd:  oklch(0.64 0.19 25 / 0.28);

  /* 6. FAMÍLIA DE RAIOS CONCÊNTRICOS */
  --radius-lg: 10px;
  --radius-md: 6px;
  --radius-sm: 4px;

  /* 7. TIPOGRAFIA DE ESTÚDIO */
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-sans:    'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  /* 8. CURVAS FÍSICAS DE MOTION */
  --ease-micro:   cubic-bezier(0.2, 0, 0, 1);
  --ease-ui:      cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spatial: cubic-bezier(0.22, 1, 0.36, 1);

  --container-max: 1280px;
  --header-h: 78px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-canvas);
  color: var(--fg-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent-subtle-bg);
  color: var(--fg-primary);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

/* Iluminação zenital estática leve (substitui filtro feTurbulence fixo para manter 60fps) */
body {
  background-image: radial-gradient(75% 42% at 50% 0%, oklch(0.765 0.158 var(--hue-brand) / 0.055), transparent 72%);
  background-repeat: no-repeat;
}

a {
  color: inherit;
  text-decoration: none;
}

img, svg, video, canvas {
  display: block;
  max-width: 100%;
}

/* Blindagem de Select no Windows Dark Mode */
select option {
  background-color: #0d1118;
  color: #f5f8fc;
}

.tabular, .price-optical, .kpi-val, .mono {
  font-variant-numeric: tabular-nums lining-nums;
}

.mono {
  font-family: var(--font-mono);
}

/* Decomposição Óptica Financeira (Regra 36) */
.price-optical {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}
.price-optical .unit,
.price-optical .cents {
  font-family: var(--font-mono);
  font-size: 0.56em;
  font-weight: 500;
  color: var(--fg-muted);
  letter-spacing: 0;
}

kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1;
  padding: 3px 6px;
  border: 1px solid var(--border-default);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  color: var(--fg-secondary);
  display: inline-flex;
  align-items: center;
}

.container-arch {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
}

/* Eyebrow Técnico */
.eyebrow-tech {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.eyebrow-tech::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-subtle-border);
}

/* Títulos Esculturais */
.h-display {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 4.9vw, 4.45rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.038em;
  margin: 0;
  text-wrap: balance;
}
.h-display .tone-muted {
  color: var(--fg-secondary);
  font-weight: 500;
}

.h-section {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.1vw, 2.75rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.028em;
  margin: 0;
  text-wrap: balance;
}

.lead-copy {
  font-size: clamp(0.98rem, 1.2vw, 1.125rem);
  line-height: 1.58;
  letter-spacing: -0.008em;
  color: var(--fg-secondary);
  max-width: 56ch;
  margin: 0;
  text-wrap: pretty;
}

/* Hierarquia Quaternária de Botões (Seção 6.1) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  user-select: none;
  transition:
    transform 130ms var(--ease-micro),
    background-color 150ms var(--ease-micro),
    border-color 150ms var(--ease-micro),
    color 150ms var(--ease-micro);
}
.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 160ms var(--ease-ui);
}
.btn:active {
  transform: translateY(1px) scale(0.99);
}
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.btn-primary {
  position: relative;
  overflow: hidden;
  background: var(--accent-primary);
  color: var(--fg-on-accent);
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.28), 0 4px 16px oklch(0.765 0.158 var(--hue-brand) / 0.22);
}
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 25%, oklch(1 0 0 / 0.28) 50%, transparent 75%);
  transform: translate3d(-130%, 0, 0);
  transition: transform 540ms var(--ease-spatial);
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover::after {
    transform: translate3d(130%, 0, 0);
  }
}
.btn-secondary {
  background: var(--bg-surface-2);
  color: var(--fg-primary);
  border-color: var(--border-default);
  box-shadow: var(--specular-top);
}
.btn-ghost {
  background: transparent;
  color: var(--fg-secondary);
  border-color: transparent;
}
.btn-danger-subtle {
  background: var(--status-err-bg);
  color: var(--status-err-fg);
  border-color: var(--status-err-bd);
}
.btn-sm {
  height: 36px;
  padding: 0 13px;
  font-size: 0.8125rem;
}
.btn-hero {
  height: 48px;
  padding: 0 22px;
  font-size: 0.9375rem;
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    background: var(--accent-primary-hover);
  }
  .btn-primary:hover .arrow-icon,
  .btn-secondary:hover .arrow-icon {
    transform: translateX(3px);
  }
  .btn-secondary:hover {
    border-color: var(--border-strong);
    background: var(--bg-floating);
  }
  .btn-ghost:hover {
    background: var(--bg-surface-2);
    color: var(--fg-primary);
  }
}

/* Badges Técnicas (Não confundir com botões — altura 23px) */
.badge-tech {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 23px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--fg-secondary);
  white-space: nowrap;
}
.badge-tech .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}
.badge-ok {
  background: var(--status-ok-bg);
  color: var(--status-ok-fg);
  border-color: var(--status-ok-bd);
}
.badge-warn {
  background: var(--status-warn-bg);
  color: var(--status-warn-fg);
  border-color: var(--status-warn-bd);
}
.badge-err {
  background: var(--status-err-bg);
  color: var(--status-err-fg);
  border-color: var(--status-err-bd);
}
.badge-accent {
  background: var(--accent-subtle-bg);
  color: var(--accent-primary);
  border-color: var(--accent-subtle-border);
}

/* Formulários e Inputs Profissionais */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--fg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.field-input,
.field-select,
.field-textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  background: var(--bg-canvas);
  color: var(--fg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: border-color 140ms var(--ease-micro), box-shadow 140ms var(--ease-micro);
}
.field-textarea {
  min-height: 98px;
  resize: vertical;
  line-height: 1.5;
}
.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-subtle-bg);
}
.field-error-msg {
  font-size: 0.76rem;
  color: var(--status-err-fg);
  min-height: 16px;
}

/* Honeypot invisível anti-bot */
.hp-trap-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Cruzetas Ópticas Suíças (+) */
.crosshair-corner {
  position: relative;
}
.crosshair-corner::after {
  content: "+";
  position: absolute;
  top: -8px;
  right: -5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  opacity: 0.55;
  pointer-events: none;
}

/* Spotlight 2D Sutil nos Cards */
.spotlight-card {
  position: relative;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--specular-top);
  transition: border-color 180ms var(--ease-micro), transform 200ms var(--ease-spatial);
}
@media (hover: hover) and (pointer: fine) {
  .spotlight-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: radial-gradient(
      320px circle at var(--mx, 50%) var(--my, 0%),
      var(--accent-subtle-border),
      transparent 72%
    );
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 200ms ease;
    pointer-events: none;
  }
  .spotlight-card:hover::before {
    opacity: 1;
  }
}

/* ==========================================================================
   HEADER GLOBAL ARQUITETURAL & FOOTER ESTRUTURADO
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: oklch(0.128 0.008 var(--hue-neutral) / 0.86);
  backdrop-filter: blur(14px) saturate(135%);
  -webkit-backdrop-filter: blur(14px) saturate(135%);
  border-bottom: 1px solid var(--border-subtle);
}
.scroll-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, oklch(0.62 0.20 250), var(--accent-primary));
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
  pointer-events: none;
}
.site-header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  transition: opacity 160ms var(--ease-micro), transform 180ms var(--ease-ui);
}
@media (hover: hover) and (pointer: fine) {
  .brand-link:hover {
    opacity: 0.92;
  }
}
.brand-logo-horiz {
  height: 50px;
  width: auto;
  object-fit: contain;
}
.footer-logo {
  height: 54px;
  width: auto;
  object-fit: contain;
  margin-bottom: 16px;
}
.brand-mark-mobile {
  display: none;
  height: 30px;
  width: auto;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-link {
  padding: 7px 13px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-secondary);
  transition: color 140ms var(--ease-micro), background-color 140ms var(--ease-micro);
}
.nav-link.active {
  color: var(--fg-primary);
  background: var(--bg-surface-2);
}
@media (hover: hover) and (pointer: fine) {
  .nav-link:hover {
    color: var(--fg-primary);
    background: var(--bg-surface-1);
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cmd-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 11px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  color: var(--fg-muted);
  font-size: 0.8rem;
  cursor: pointer;
}
.mobile-menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--fg-primary);
  cursor: pointer;
}

/* Rodapé Arquitetural Estruturado */
.site-footer {
  position: relative;
  z-index: 5;
  border-top: 1px solid var(--border-subtle);
  background: oklch(0.115 0.008 var(--hue-neutral) / 0.96);
  padding: 64px 0 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.1fr;
  gap: 36px;
  padding-bottom: 44px;
  border-bottom: 1px solid var(--border-subtle);
}
.footer-col-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  margin: 0 0 14px;
}
.footer-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 0.88rem;
  color: var(--fg-secondary);
}
.footer-bottom {
  padding-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--fg-muted);
}

/* ==========================================================================
   OMNIBAR COMMAND PALETTE (⌘K) & TOAST ENGINE
   ========================================================================== */
.cmd-backdrop {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: oklch(0.06 0.008 var(--hue-neutral) / 0.74);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 11vh 16px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms var(--ease-ui);
}
.cmd-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.cmd-dialog {
  width: 100%;
  max-width: 580px;
  background: var(--bg-floating);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--specular-top), 0 28px 64px oklch(0 0 0 / 0.55);
  overflow: hidden;
  transform: translateY(8px) scale(0.985);
  transition: transform 200ms var(--ease-ui);
}
.cmd-backdrop.open .cmd-dialog {
  transform: translateY(0) scale(1);
}
.cmd-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.cmd-search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--fg-primary);
  font-family: var(--font-sans);
  font-size: 0.96rem;
  outline: none;
}
.cmd-results {
  max-height: 340px;
  overflow-y: auto;
  padding: 8px;
}
.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--fg-secondary);
  font-size: 0.875rem;
  cursor: pointer;
}
.cmd-item:hover,
.cmd-item.active {
  background: var(--bg-surface-2);
  color: var(--fg-primary);
}

/* Mobile Nav Sheet */
.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: oklch(0.06 0.008 var(--hue-neutral) / 0.72);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease-ui);
}
.mobile-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.mobile-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 91;
  background: var(--bg-surface-1);
  border-top: 1px solid var(--border-default);
  border-radius: 18px 18px 0 0;
  padding: 14px 18px calc(22px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 260ms var(--ease-spatial);
}
.mobile-drawer-backdrop.open .mobile-drawer {
  transform: translateY(0);
}
.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
  margin: 0 auto 16px;
}

/* Toasts Não-Bloqueantes */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(390px, calc(100vw - 32px));
}
.toast-card {
  background: var(--bg-floating);
  border: 1px solid var(--border-default);
  border-left: 3px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 12px 15px;
  box-shadow: 0 14px 36px oklch(0 0 0 / 0.45);
  font-size: 0.85rem;
  color: var(--fg-primary);
  animation: toastIn 220ms var(--ease-ui);
}
.toast-card.err {
  border-left-color: var(--status-err-fg);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Resiliência Progressiva de Entrada com Stagger Suave */
.js-ready [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition:
    opacity 620ms var(--ease-spatial) var(--reveal-delay, 0ms),
    transform 680ms var(--ease-spatial) var(--reveal-delay, 0ms);
}
.js-ready [data-reveal].is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* ==========================================================================
   AS 7 LEIS DO MOBILE (<= 768px — Seção 7.1)
   ========================================================================== */
@media (max-width: 768px) {
  :root {
    --header-h: 64px;
  }
  .site-header {
    height: var(--header-h);
  }
  .nav-links,
  .cmd-trigger .cmd-label-txt {
    display: none;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .brand-logo-horiz {
    height: 40px;
  }
  .footer-logo {
    height: 44px;
  }
  /* Previne zoom forçado no Safari iOS (Regra 30) */
  .field-input,
  .field-select,
  .field-textarea {
    font-size: 16px;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
  .footer-grid > :first-child {
    grid-column: 1 / -1;
  }
}

/* Evita animações bruscas mantendo transições confortáveis e sem loops acelerados */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
