/* ========================================
   GRAPHADE — Shared Design System
   ======================================== */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

/* --- CSS Variables --- */
:root {
  --bg: #080808;
  --surface: #1C1C1C;
  --border: #1e1e1e;
  --accent: #15DCFF;
  --white: #F2F2F2;
  --muted: #888888;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --container-max: 1200px;
  --nav-height: 72px;
  --radius: 8px;
  --transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- Reset --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--white);
  background: var(--bg);
  overflow-x: hidden;
  cursor: none;
}

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

button, input, select, textarea {
  font-family: inherit;
  cursor: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 2px;
  color: var(--white);
  text-transform: uppercase;
}

h1 { font-size: clamp(3rem, 8vw, 7rem); }
h2 { font-size: clamp(2rem, 5vw, 4rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2.4rem); }
h4 { font-size: clamp(1.2rem, 2vw, 1.8rem); }

p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 640px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--accent);
  margin-bottom: 16px;
  display: inline-block;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
}

/* --- Layout --- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

.section {
  padding: 120px 0;
  position: relative;
}

.section-sm {
  padding: 80px 0;
  position: relative;
}

/* --- Noise Overlay --- */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* --- Background Grid --- */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* --- Three.js Background Canvas --- */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2; /* Behind the grid and everything else */
  pointer-events: none; /* Don't block interactions */
}

/* --- Custom Cursor --- */
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  margin: 0;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transition: width 0.2s, height 0.2s, background-color 0.2s;
  will-change: transform, width, height;
}

.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  margin: 0;
  width: 36px;
  height: 36px;
  border: 1.5px solid rgba(21, 220, 255, 0.4); /* Replaced difference blend with opacity */
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transition: width 0.15s, height 0.15s, border-color 0.2s;
  will-change: transform, width, height;
}

.cursor-dot.hover {
  width: 14px;
  height: 14px;
  background: var(--accent);
}

.cursor-ring.hover {
  width: 50px;
  height: 50px;
  border-color: var(--accent);
}

/* --- Navbar --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 1000;
  transition: background var(--transition), box-shadow var(--transition);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: transparent;
}

.navbar.scrolled {
  background: rgba(8, 8, 8, 0.92);
  box-shadow: 0 1px 0 var(--border);
}

.navbar__logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}

.navbar__links {
  display: flex;
  gap: 36px;
  align-items: center;
}

.navbar__links a {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  transition: color var(--transition);
  position: relative;
}

.navbar__links a:hover,
.navbar__links a.active {
  color: var(--white);
}

.navbar__links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--transition);
}

.navbar__links a:hover::after,
.navbar__links a.active::after {
  width: 100%;
}

.navbar__cta {
  flex-shrink: 0;
}

/* Hamburger */
.navbar__hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 8px;
  z-index: 1001;
}

.navbar__hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--white);
  transition: all var(--transition);
}

.navbar__hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.navbar__hamburger.active span:nth-child(2) {
  opacity: 0;
}

.navbar__hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Nav */
.mobile-nav {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  height: 100vh;
  background: rgba(8, 8, 8, 0.98);
  backdrop-filter: blur(20px);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.mobile-nav.active {
  right: 0;
}

.mobile-nav a {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  transition: color var(--transition);
}

.mobile-nav a:hover {
  color: var(--accent);
}

/* --- Buttons --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: var(--accent);
  color: #000;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(21, 220, 255, 0.2);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: transparent;
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 10px 24px;
  font-size: 0.85rem;
}

/* --- Scroll Reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: all var(--transition);
}

.card:hover {
  border-color: rgba(21, 220, 255, 0.15);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border);
  padding: 60px 0 40px;
  position: relative;
}

.footer__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.footer__logo {
  height: 32px;
  width: auto;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
}

.footer__links a {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--muted);
  transition: color var(--transition);
}

.footer__links a:hover {
  color: var(--accent);
}

.footer__copy {
  font-size: 0.8rem;
  color: var(--muted);
  opacity: 0.6;
  text-align: center;
}

/* --- Divider --- */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 0;
}

/* --- Accent text --- */
.text-accent {
  color: var(--accent);
}

.text-muted {
  color: var(--muted);
}

/* ========================================
   SCROLL-LINKED ANIMATIONS
   ======================================== */

/* --- Scroll Progress Bar --- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
  z-index: 10001;
  pointer-events: none;
  will-change: transform;
  box-shadow: 0 0 12px rgba(21, 220, 255, 0.4), 0 0 4px rgba(21, 220, 255, 0.6);
}

/* --- Scroll Geometric Element --- */
.scroll-geo {
  position: fixed;
  bottom: 110px;
  right: 34px;
  width: 80px;
  height: 80px;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.scroll-geo.visible {
  opacity: 1;
}

.scroll-geo__outer {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(21, 220, 255, 0.12);
  border-radius: 50%;
  will-change: transform;
  backface-visibility: hidden;
}

.scroll-geo__middle {
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(21, 220, 255, 0.1);
  will-change: transform;
  backface-visibility: hidden;
  transform: rotate(45deg);
}

.scroll-geo__inner {
  position: absolute;
  inset: 28px;
  border: 1px dashed rgba(21, 220, 255, 0.08);
  border-radius: 50%;
  will-change: transform;
  backface-visibility: hidden;
}

.scroll-geo__dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(21, 220, 255, 0.5);
  animation: geoDotPulse 3s ease-in-out infinite;
}

@keyframes geoDotPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(21, 220, 255, 0.5); }
  50% { box-shadow: 0 0 20px rgba(21, 220, 255, 0.8), 0 0 40px rgba(21, 220, 255, 0.2); }
}

/* Satellite dots orbiting the geometric element */
.scroll-geo__sat {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.4;
  will-change: transform;
  backface-visibility: hidden;
}

.scroll-geo__sat--1 { top: -2px; left: 50%; transform: translateX(-50%); }
.scroll-geo__sat--2 { bottom: -2px; right: 10px; }
.scroll-geo__sat--3 { top: 50%; left: -2px; transform: translateY(-50%); }

/* --- Side Scroll Track --- */
.scroll-track {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 120px;
  background: rgba(21, 220, 255, 0.06);
  z-index: 50;
  pointer-events: none;
}

.scroll-track__thumb {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.3;
  will-change: top;
  transition: opacity 0.3s ease;
  box-shadow: 0 0 6px rgba(21, 220, 255, 0.3);
}

.scroll-track.active .scroll-track__thumb {
  opacity: 0.7;
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* GPU acceleration for animated elements */
.orb,
.scroll-geo__outer,
.scroll-geo__middle,
.scroll-geo__inner {
  will-change: transform;
  transform: translateZ(0);
}

.cursor-dot,
.cursor-ring {
  will-change: transform, width, height, background-color, border-color;
  /* DO NOT use transform: translateZ(0) here as it overrides translate(-50%, -50%) */
}

/* Content-visibility for off-screen sections */
.section,
.section-sm {
  content-visibility: auto;
  contain-intrinsic-size: auto 600px;
}

/* Contain paint on repetitive cards */
.card,
.service-card,
.s-card {
  contain: layout style paint;
}

/* Image rendering hints */
img {
  image-rendering: auto;
  -webkit-image-rendering: auto;
}

/* ========================================
   RESPONSIVE — ENHANCED
   ======================================== */

@media (max-width: 1024px) {
  .section { padding: 80px 0; }
  .container { padding: 0 20px; }
  .scroll-geo { width: 60px; height: 60px; bottom: 100px; right: 30px; }
  .scroll-geo__middle { inset: 12px; }
  .scroll-geo__inner { inset: 22px; }
}

@media (max-width: 768px) {
  .section { padding: 60px 0; }
  .section-sm { padding: 50px 0; }
  .navbar { padding: 0 20px; }

  .navbar__links,
  .navbar__cta {
    display: none;
  }

  .navbar__hamburger {
    display: flex;
  }

  h1 { font-size: clamp(2.4rem, 10vw, 3.5rem); }
  h2 { font-size: clamp(1.8rem, 6vw, 2.8rem); }

  .footer__links {
    gap: 16px;
    font-size: 0.82rem;
  }

  /* Touch-friendly targets */
  .btn-primary, .btn-ghost {
    min-height: 48px;
    padding: 14px 28px;
  }

  .navbar__hamburger {
    padding: 12px;
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
    align-items: center;
  }

  .mobile-nav a {
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  /* Hide geo element on mobile */
  .scroll-geo { display: none; }
  .scroll-track { display: none; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .section { padding: 48px 0; }
  .section-sm { padding: 36px 0; }
  .btn-primary, .btn-ghost {
    width: 100%;
    justify-content: center;
  }

  h1 { font-size: clamp(2rem, 10vw, 3rem); }

  .footer { padding: 40px 0 32px; }
  .footer__inner { gap: 24px; }
  .footer__links { gap: 12px; }
}

@media (max-width: 360px) {
  .container { padding: 0 12px; }
  .eyebrow { font-size: 0.65rem; letter-spacing: 2px; }
  h1 { font-size: 2rem; }
}

/* ========================================
   FLOATING WHATSAPP BUTTON
   ======================================== */

.wa-float {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  background: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  text-decoration: none;
  cursor: none;
}

.wa-float:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(37, 211, 102, 0.6);
}

.wa-float svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  flex-shrink: 0;
}

/* Notification dot */
.wa-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: waDotPulse 2.5s ease-in-out infinite;
}

@keyframes waDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* Tooltip */
.wa-tooltip {
  position: absolute;
  right: 68px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(8, 8, 8, 0.92);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.wa-float:hover .wa-tooltip {
  opacity: 1;
}

@media (max-width: 480px) {
  .wa-float {
    bottom: 20px;
    right: 20px;
    width: 52px;
    height: 52px;
  }
  .wa-float svg {
    width: 26px;
    height: 26px;
  }
  .wa-tooltip { display: none; }
}

@media (hover: none) {
  .wa-float { cursor: pointer; }
  .wa-tooltip { display: none; }
}

/* --- Accessibility --- */
@media (hover: none) {
  .cursor-dot, .cursor-ring { display: none !important; }
  body, a, button, input, select, textarea { cursor: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .scroll-geo { display: none; }
  .scroll-progress { transition: none; }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
