/* Base Oito — Design System */

:root {
  --navy: #081B2B;
  --cyan: #00C8FF;
  --white: #FFFFFF;
  --gray-tech: #A5B1BD;
  --graphite: #1A1F26;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--navy);
  color: var(--white);
  font-family: 'Inter', sans-serif;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Manrope', sans-serif;
}

/* Glassmorphism Card */
.glass-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Border beam hover — gradient that follows mouse */
.beam-card {
  position: relative;
  --mouse-x: 50%;
  --mouse-y: 50%;
}

.beam-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(circle 200px at var(--mouse-x) var(--mouse-y), rgba(0, 200, 255, 0.35), transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 1;
}

.beam-card:hover::before {
  opacity: 1;
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(0, 200, 255, 0.15);
  transform: translateY(-4px) scale(1.015);
}

/* Header scroll state */
#header.scrolled {
  background: rgba(8, 27, 43, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#header.scrolled .max-w-\[1400px\] > nav {
  padding: 0;
}

/* Link underline animation */
nav a:not(.inline-flex) {
  position: relative;
}

nav a:not(.inline-flex)::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--cyan);
  transition: width 0.3s ease;
}

nav a:not(.inline-flex):hover::after {
  width: 100%;
}

/* Active scroll nav indicator */
.nav-links-wrapper {
  position: relative;
}

#nav-indicator {
  position: absolute;
  bottom: -4px;
  height: 1px;
  background: var(--cyan);
  opacity: 0;
  pointer-events: none;
  transition: left 0.45s cubic-bezier(0.16, 1, 0.3, 1), width 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  box-shadow: 0 0 8px rgba(0, 200, 255, 0.5);
}

.nav-link {
  transition: color 0.3s ease;
}

.nav-link.active {
  color: var(--white) !important;
}

/* Particle canvas */
#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Tech Grid Background — Octal pattern (24px = base 8 × 3) */
.tech-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image:
    linear-gradient(to right, rgba(0, 200, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 200, 255, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse 80% 60% at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at center, black 30%, transparent 80%);
  opacity: 0.6;
}

/* Grid flashlight — follows mouse cursor */
.tech-grid-flashlight {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image:
    linear-gradient(to right, rgba(0, 200, 255, 0.18) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 200, 255, 0.18) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle 260px at var(--mouse-x, 50%) var(--mouse-y, 30%), black 0%, transparent 90%);
  -webkit-mask-image: radial-gradient(circle 260px at var(--mouse-x, 50%) var(--mouse-y, 30%), black 0%, transparent 90%);
  opacity: 0;
  transition: opacity 0.6s ease;
}

.tech-grid-flashlight.visible {
  opacity: 1;
}

/* Noise Overlay */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Vertical Beams */
.beam-v {
  position: absolute;
  width: 1px;
  height: 180px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 200, 255, 0.6) 50%, transparent 100%);
  opacity: 0;
  z-index: 1;
  animation: beam-fall 6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  pointer-events: none;
  filter: blur(0.5px);
  will-change: top, opacity;
}

@keyframes beam-fall {
  0% { top: -200px; opacity: 0; }
  15% { opacity: 0.5; }
  85% { opacity: 0.5; }
  100% { top: calc(100% + 200px); opacity: 0; }
}

/* Conic border card (premium hover) */
.premium-border-card {
  position: relative;
  border-radius: 16px;
  padding: 1px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  isolation: isolate;
}

.premium-border-card .border-track {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: conic-gradient(from 0deg, transparent 0deg, transparent 270deg, #00C8FF 360deg);
  animation: border-spin 3.5s linear infinite;
  opacity: 0;
  filter: blur(1px);
  transition: opacity 0.4s ease;
  z-index: 0;
}

.premium-border-card:hover .border-track {
  opacity: 0.6;
}

.premium-border-card .border-fill {
  position: absolute;
  inset: 1px;
  border-radius: 15px;
  background: #081B2B;
  z-index: 1;
}

.premium-border-card .border-content {
  position: relative;
  z-index: 2;
}

@keyframes border-spin {
  to { transform: rotate(360deg); }
}

/* Animated counter */
.counter {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* Split-line text reveal */
.split-line {
  overflow: hidden;
  display: inline-block;
  line-height: 1.15;
  vertical-align: top;
}

.split-line > span {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 1s cubic-bezier(0.23, 1, 0.32, 1);
}

.split-line.revealed > span {
  transform: translateY(0);
}

/* Process Line */
#process-line {
  opacity: 0.7;
  transition: opacity 0.5s ease;
}

.process-node {
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.process-node.active {
  opacity: 1 !important;
  fill: rgba(0, 200, 255, 0.2);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 8px rgba(0, 200, 255, 0.5));
}

@media (max-width: 768px) {
  #process-line {
    display: none;
  }
}

/* Selection */
::selection {
  background-color: rgba(0, 200, 255, 0.25);
  color: var(--white);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--navy);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Reveal animations — initial state set by GSAP via .gsap-init class */
.gsap-init .reveal {
  opacity: 0;
  transform: translateY(24px);
}

/* Focus states */
input:focus,
textarea:focus {
  box-shadow: 0 0 0 3px rgba(0, 200, 255, 0.1);
}

/* Design Token Sandbox */
#token-color {
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
}

#token-color::-webkit-color-swatch-wrapper {
  padding: 0;
}

#token-color::-webkit-color-swatch {
  border: none;
  border-radius: 10px;
}

#token-hue {
  -webkit-appearance: none;
  appearance: none;
}

#token-hue::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cyan, #00C8FF);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 200, 255, 0.5);
}

#token-hue::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: var(--cyan, #00C8FF);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 200, 255, 0.5);
}

/* Floating labels */
.floating-field {
  position: relative;
}

.floating-field input,
.floating-field textarea {
  width: 100%;
  padding: 1.25rem 1.25rem 0.5rem 1.25rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  resize: none;
}

.floating-field input::placeholder,
.floating-field textarea::placeholder {
  color: transparent;
}

.floating-field label {
  position: absolute;
  left: 1.25rem;
  top: 1rem;
  font-size: 0.95rem;
  color: #A5B1BD;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: left center;
}

.floating-field input:focus + label,
.floating-field input:not(:placeholder-shown) + label,
.floating-field textarea:focus + label,
.floating-field textarea:not(:placeholder-shown) + label {
  transform: translateY(-0.55rem) scale(0.75);
  color: #00C8FF;
  font-weight: 500;
}

.floating-field input:focus,
.floating-field textarea:focus {
  border-color: rgba(0, 200, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 200, 255, 0.1);
}

/* Form button states */
#cf-submit.loading {
  background: rgba(0, 200, 255, 0.5);
  cursor: wait;
  pointer-events: none;
}

#cf-submit.success {
  background: var(--success, #00D26A);
  pointer-events: none;
}

#cf-submit.error {
  background: var(--error, #FF4D5A);
  pointer-events: none;
}

#form-status.status-success {
  background: rgba(0, 210, 106, 0.1);
  border: 1px solid rgba(0, 210, 106, 0.2);
  color: #00D26A;
  display: block;
}

#form-status.status-error {
  background: rgba(255, 77, 90, 0.1);
  border: 1px solid rgba(255, 77, 90, 0.2);
  color: #FF4D5A;
  display: block;
}

/* Image treatment */
img {
  max-width: 100%;
  height: auto;
}

/* Print fallback — ensure content remains visible */
@media print {
  .gsap-init .reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  #particle-canvas,
  #header,
  .absolute.inset-0.bg-gradient-to-b,
  .absolute.top-1\/2.left-1\/2 {
    display: none !important;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* WhatsApp floating button */
#whatsapp-float {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: whatsapp-enter 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.3s backwards;
}

@keyframes whatsapp-enter {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#whatsapp-float .animate-ping {
  animation: ping 2.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@media (max-width: 640px) {
  #whatsapp-float {
    bottom: 1.25rem;
    right: 1.25rem;
  }
}
