/* Theme toggle pill */
.theme-pill {
  display: inline-flex;
  align-items: center;
}
.theme-track {
  display: inline-flex;
  align-items: center;
  width: 50px;
  height: 26px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--rule-strong);
  position: relative;
  padding: 0 6px;
  justify-content: space-between;
  transition: background var(--t-fast);
}
.theme-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--fg);
  transition: transform var(--t-med) var(--ease-out);
  z-index: 1;
}
.theme-track[data-on="true"] .theme-thumb { transform: translateX(24px); background: var(--accent); }
.theme-icon { color: var(--fg-muted); width: 12px; height: 12px; z-index: 2; pointer-events: none; }
.theme-track[data-on="true"] .sun { opacity: 0.4; }
.theme-track[data-on="false"] .moon { opacity: 0.4; }

@media (max-width: 900px) {
  .nav-cta span { display: none; }
}

/* Tweaks panel */
.tweaks-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  width: 280px;
  background: var(--bg);
  border: 1px solid var(--rule-strong);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 20px 60px rgba(21, 3, 45, 0.18);
  font-family: var(--font-sans);
}
.tweaks-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.tweaks-head button {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-soft);
  font-size: 16px;
  color: var(--fg-muted);
  display: grid; place-items: center;
}
.tweaks-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
}
.tweaks-row .seg {
  display: flex;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  overflow: hidden;
}
.tweaks-row .seg button {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-faint);
  transition: background var(--t-fast), color var(--t-fast);
}
.tweaks-row .seg button.on { background: var(--fg); color: var(--bg); }

/* ===================================================================
 * CHATBOT DRAWER (lateral, abre da direita)
 * =================================================================== */
.chat-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(21, 3, 45, 0.35);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 360ms ease-out;
}
.chat-backdrop.open { opacity: 1; pointer-events: auto; }

.chat-drawer {
  position: fixed;
  top: 0; right: 0;
  bottom: 0;
  width: min(440px, 100%);
  background: var(--bg);
  border-left: 1px solid var(--rule);
  z-index: 999;
  transform: translateX(100%);
  transition: transform 480ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  box-shadow: -32px 0 80px rgba(21, 3, 45, 0.18);
}
.chat-drawer.open { transform: translateX(0); }

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid var(--rule);
}
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-hi), var(--accent));
  display: grid;
  place-items: center;
  position: relative;
}
.chat-avatar::after {
  content: "";
  position: absolute;
  bottom: 0; right: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.chat-avatar svg { width: 18px; height: 18px; color: white; }
.chat-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.chat-header .status {
  font-size: 11px;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.chat-header .status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.chat-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-soft);
  display: grid; place-items: center;
  font-size: 18px;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background var(--t-fast);
}
.chat-close:hover { background: var(--bg-alt); color: var(--fg); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chat-bubble {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.45;
  animation: bubble-in 360ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--fg);
  color: var(--bg);
  border-bottom-right-radius: 4px;
}
.chat-bubble.bot {
  align-self: flex-start;
  background: var(--bg-soft);
  color: var(--fg);
  border-bottom-left-radius: 4px;
}
.chat-bubble.bot strong { color: var(--primary-hi); font-weight: 500; }
.chat-typing {
  display: flex;
  gap: 4px;
  padding: 16px;
}
.chat-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--fg-faint);
  animation: typing-dot 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}
.chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.chat-suggestions button {
  text-align: left;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 13px;
  color: var(--fg);
  cursor: pointer;
  transition: all var(--t-fast);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.chat-suggestions button:hover {
  border-color: var(--primary-hi);
  background: color-mix(in srgb, var(--primary-hi) 5%, transparent);
}
.chat-suggestions button svg { width: 12px; height: 12px; color: var(--fg-faint); }

.chat-form {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--rule);
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg);
}
.chat-form input {
  flex: 1;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 100px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  color: var(--fg);
  outline: 0;
  transition: border-color var(--t-fast);
}
.chat-form input:focus { border-color: var(--primary-hi); }
.chat-form button {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--fg);
  color: var(--bg);
  display: grid; place-items: center;
  cursor: pointer;
  border: 0;
  transition: transform var(--t-fast);
}
.chat-form button:hover { transform: scale(1.05); }
.chat-form button svg { width: 16px; height: 16px; }

/* ===================================================================
 * FEATURES SECTION (animação tipo Sentinel — 3D parallax cards)
 * =================================================================== */
.features {
  padding: var(--s-10) var(--gutter);
  background: var(--bg-alt);
  position: relative;
  overflow: hidden;
}
.features-head {
  max-width: var(--container);
  margin: 0 auto var(--s-8);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-7);
  align-items: end;
}
.features-head h2 {
  font-size: clamp(40px, 5.4vw, 88px);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 0.98;
  margin: 16px 0 0;
}
.features-head h2 em {
  font-style: normal;
  color: var(--primary-hi);
  font-weight: 500;
}
.features-head .lead {
  font-size: 17px;
  color: var(--fg-muted);
  max-width: 460px;
  line-height: 1.55;
  font-weight: 300;
}

.features-grid {
  max-width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(180px, auto);
  gap: 16px;
  perspective: 1400px;
}
.feature {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 20px;
  padding: 28px;
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 600ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 600ms;
  cursor: default;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
}
.feature:hover {
  transform: translateY(-4px) rotateX(2deg);
  box-shadow: 0 24px 60px -20px rgba(105, 17, 223, 0.25);
}
.feature-num {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--fg-faint);
  font-weight: 500;
  margin-bottom: 12px;
}
.feature h3 {
  font-size: 22px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.012em;
  margin: 0 0 12px;
  text-wrap: balance;
}
.feature p {
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg-muted);
  margin: 0 0 20px;
  font-weight: 300;
}

/* Layout: 12-col bento */
.feature.f1 { grid-column: span 7; grid-row: span 2; min-height: 380px; }
.feature.f2 { grid-column: span 5; }
.feature.f3 { grid-column: span 5; }
.feature.f4 { grid-column: span 4; }
.feature.f5 { grid-column: span 4; }
.feature.f6 { grid-column: span 4; }

@media (max-width: 980px) {
  .features-head { grid-template-columns: 1fr; }
  .feature.f1, .feature.f2, .feature.f3 { grid-column: span 12; grid-row: auto; min-height: 240px; }
  .feature.f4, .feature.f5, .feature.f6 { grid-column: span 6; }
}
@media (max-width: 600px) {
  .feature { grid-column: span 12 !important; }
}

/* Visual area inside each feature (animated graphics) */
.feature-visual {
  position: relative;
  flex: 1;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Visual 1: Animated bar chart */
.viz-bars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 200px;
  padding: 0 12px;
  width: 100%;
}
.viz-bars .bar {
  flex: 1;
  background: linear-gradient(to top, var(--primary-hi), color-mix(in srgb, var(--primary-hi) 30%, transparent));
  border-radius: 8px 8px 0 0;
  position: relative;
  transform-origin: bottom;
  animation: bar-grow 2.4s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
.viz-bars .bar:nth-child(1) { animation-delay: 0s; height: 60%; }
.viz-bars .bar:nth-child(2) { animation-delay: 0.15s; height: 75%; }
.viz-bars .bar:nth-child(3) { animation-delay: 0.3s; height: 45%; background: linear-gradient(to top, var(--accent), color-mix(in srgb, var(--accent) 40%, transparent)); }
.viz-bars .bar:nth-child(4) { animation-delay: 0.45s; height: 90%; }
.viz-bars .bar:nth-child(5) { animation-delay: 0.6s; height: 70%; }
.viz-bars .bar:nth-child(6) { animation-delay: 0.75s; height: 55%; }
.viz-bars .bar:nth-child(7) { animation-delay: 0.9s; height: 80%; }
@keyframes bar-grow {
  0%, 100% { transform: scaleY(0.85); }
  50% { transform: scaleY(1); }
}

/* Visual 2: Pipeline / data flow */
.viz-flow {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}
.viz-flow .node {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--rule-strong);
  display: grid; place-items: center;
  position: relative;
  z-index: 2;
}
.viz-flow .node svg { width: 18px; height: 18px; color: var(--fg-muted); }
.viz-flow .pipe {
  flex: 1;
  height: 2px;
  background: var(--rule-strong);
  position: relative;
  overflow: hidden;
}
.viz-flow .pipe::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, transparent 0%, var(--accent) 50%, transparent 100%);
  width: 30%;
  animation: pipe-flow 2.2s linear infinite;
}
.viz-flow .pipe:nth-child(4)::after { animation-delay: 0.4s; }
@keyframes pipe-flow {
  from { transform: translateX(-100%); }
  to { transform: translateX(400%); }
}

/* Visual 3: AI orbit */
.viz-orbit {
  width: 200px;
  height: 200px;
  position: relative;
}
.viz-orbit::before, .viz-orbit::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px dashed var(--rule-strong);
  border-radius: 50%;
}
.viz-orbit::after {
  inset: 18%;
  border-style: solid;
  border-color: var(--rule);
}
.viz-orbit .core {
  position: absolute;
  left: 50%; top: 50%;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-hi), var(--primary));
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  color: white;
  box-shadow: 0 0 30px color-mix(in srgb, var(--primary-hi) 50%, transparent);
}
.viz-orbit .core svg { width: 22px; height: 22px; }
.viz-orbit .satellite {
  position: absolute;
  left: 50%; top: 50%;
  width: 22px; height: 22px;
  margin: -11px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--rule-strong);
  display: grid; place-items: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--fg-muted);
  animation: orbit 16s linear infinite;
  transform-origin: 0 0;
}
.viz-orbit .satellite span {
  display: inline-block;
  animation: orbit-counter 16s linear infinite;
}
.viz-orbit .satellite.s2 { animation-duration: 22s; animation-direction: reverse; }
.viz-orbit .satellite.s2 span { animation-duration: 22s; animation-direction: reverse; }
.viz-orbit .satellite.s3 { animation-duration: 28s; }
.viz-orbit .satellite.s3 span { animation-duration: 28s; }
@keyframes orbit {
  from { transform: rotate(0) translateX(70px); }
  to { transform: rotate(360deg) translateX(70px); }
}
@keyframes orbit-counter {
  from { transform: rotate(0); }
  to { transform: rotate(-360deg); }
}

/* Visual: cloud */
.viz-cloud {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 8px;
}
.viz-cloud div {
  border-radius: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  position: relative;
  overflow: hidden;
}
.viz-cloud div::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 30%, color-mix(in srgb, var(--primary-hi) 20%, transparent) 50%, transparent 70%);
  animation: cloud-shimmer 3s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.viz-cloud div:nth-child(2) { --d: 0.2s; }
.viz-cloud div:nth-child(3) { --d: 0.4s; }
.viz-cloud div:nth-child(4) { --d: 0.6s; }
.viz-cloud div:nth-child(5) { --d: 0.8s; }
.viz-cloud div:nth-child(6) { --d: 1s; }
@keyframes cloud-shimmer {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}

/* Visual: shield (cyber) */
.viz-shield {
  width: 120px; height: 140px;
  position: relative;
}
.viz-shield svg {
  width: 100%; height: 100%;
  color: var(--primary-hi);
  filter: drop-shadow(0 0 12px color-mix(in srgb, var(--primary-hi) 40%, transparent));
}
.viz-shield::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 180px; height: 180px;
  border: 1px solid color-mix(in srgb, var(--primary-hi) 30%, transparent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: ripple 2.4s ease-out infinite;
}
.viz-shield::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 180px; height: 180px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: ripple 2.4s ease-out 1.2s infinite;
}
@keyframes ripple {
  0% { width: 80px; height: 80px; opacity: 1; }
  100% { width: 220px; height: 220px; opacity: 0; }
}

/* Visual: ops 24/7 */
.viz-ops {
  width: 100%;
  display: grid;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 8px;
}
.viz-ops .row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  padding: 8px 12px;
  background: var(--bg-soft);
  border-radius: 8px;
  border-left: 2px solid var(--accent);
  opacity: 0;
  animation: ops-in 4s linear infinite;
}
.viz-ops .row:nth-child(2) { animation-delay: 0.5s; border-left-color: var(--primary-hi); }
.viz-ops .row:nth-child(3) { animation-delay: 1s; }
.viz-ops .row .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
@keyframes ops-in {
  0% { opacity: 0; transform: translateX(-8px); }
  10%, 80% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateX(8px); }
}

/* Floating chat bubble (FAB) */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--fg);
  color: var(--bg);
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 12px 40px rgba(21, 3, 45, 0.25);
  z-index: 900;
  border: 0;
  transition: transform var(--t-fast), background var(--t-fast);
}
.chat-fab:hover { transform: scale(1.06); }
.chat-fab svg { width: 22px; height: 22px; }
.chat-fab::after {
  content: "";
  position: absolute;
  top: 6px; right: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--fg);
}
