/* ============================================================
   360 SAAS — Design System & Styles
   Deep-black glass. One accent. Spring-driven.
   Font: Satoshi + JetBrains Mono
   Palette: #0a0a0a bg, #3B82F6 accent, glass surfaces
   ============================================================ */

/* --- Custom Properties (Design Tokens) --- */
:root {
  /* Palette — NON-NEGOTIABLE */
  --bg: #0a0a0a;
  --surface: rgba(255,255,255,0.06);
  --surface-raised: rgba(255,255,255,0.10);
  --glass: rgba(255,255,255,0.15);
  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,0.6);
  --accent: #3B82F6;

  /* Typography scale — fluid clamp() */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
  --text-xl: clamp(1.25rem, 1rem + 1.2vw, 1.75rem);
  --text-2xl: clamp(1.5rem, 1.2rem + 1.5vw, 2.25rem);
  --text-3xl: clamp(1.875rem, 1.4rem + 2.4vw, 3rem);
  --text-4xl: clamp(2.25rem, 1.6rem + 3.2vw, 4rem);
  --text-hero: clamp(2.5rem, 1.8rem + 3.5vw, 5rem);

  /* Spacing — Apple-breathes */
  --space-xs: clamp(0.5rem, 0.4rem + 0.5vw, 0.75rem);
  --space-sm: clamp(0.75rem, 0.6rem + 0.75vw, 1rem);
  --space-md: clamp(1rem, 0.8rem + 1vw, 1.5rem);
  --space-lg: clamp(1.5rem, 1.2rem + 1.5vw, 2.5rem);
  --space-xl: clamp(2rem, 1.5rem + 2.5vw, 4rem);
  --space-2xl: clamp(3rem, 2rem + 5vw, 7rem);
  --space-3xl: clamp(4rem, 3rem + 5vw, 9rem);

  /* Nav */
  --nav-height: 72px;
  --nav-height-shrunk: 56px;

  /* Animation engineering — custom easings (Emil) */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  /* Hero text colour transition thresholds */
  --hero-text-transition-start: 0.55;
  --hero-text-transition-end: 0.85;
}

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

html {
  scroll-behavior: auto; /* Lenis handles smooth scroll */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
  overflow-x: hidden;
}

body {
  font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* Contact form submit button — ensure visible background (Issue #4) */
#contact-form button[type="submit"] {
  background-color: var(--accent);
}

ul, ol {
  list-style: none;
}


/* ============================================================
   NAVIGATION — Sticky glass pill, spring shrink
   ============================================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: var(--space-sm) 0;
  transition: padding 0.4s var(--ease-out);
}

.nav--scrolled {
  padding: 0.4rem 0;
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 1rem + 2vw, 3rem);
  background: rgba(255,255,255,0.12);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  backdrop-filter: blur(28px) saturate(1.6);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.08);
  border-radius: 100px;
  height: var(--nav-height);
  transition: height 0.4s var(--ease-out), background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.nav--scrolled .nav__inner {
  height: var(--nav-height-shrunk);
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.22);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15), 0 2px 6px rgba(0,0,0,0.10);
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav__logo:hover {
  color: var(--text-primary);
}

.nav__logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.8rem;
  color: #fff;
  transition: transform 0.3s var(--ease-out);
}

.nav__logo:hover .nav__logo-mark {
  transform: scale(1.08) rotate(-3deg);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 1.5vw, 2rem);
}

/* Nav elements stay white regardless of hero phase */
.nav__logo,
.nav__link,
.nav__cta,
.phone-pill {
  color: #fff !important;
}

.nav__link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  transition: color 0.2s ease;
  position: relative;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s var(--ease-out);
}

/* Hover gate — desktop only */
@media (hover: hover) and (pointer: fine) {
  .nav__link:hover {
    color: var(--text-primary);
  }
  .nav__link:hover::after {
    width: 100%;
  }
}

.nav__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.4rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: 100px;
  transition: transform 0.16s ease-out, box-shadow 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .nav__cta:hover {
    box-shadow: 0 4px 20px rgba(59,130,246,0.3);
    color: #fff;
  }
}

.nav__cta:active {
  transform: scale(0.97);
}

/* Phone pill */
.phone-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--text-xs);
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  padding: 0.3rem 0.8rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 100px;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .phone-pill:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.25);
    color: #fff;
  }
}

/* Mobile hamburger */
.nav__hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 28px;
  padding: 4px 0;
  cursor: pointer;
}

.nav__hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav__hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.nav__hamburger.active span:nth-child(2) {
  opacity: 0;
}
.nav__hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile overlay */
.nav__overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,0.92);
  -webkit-backdrop-filter: blur(32px);
  backdrop-filter: blur(32px);
  z-index: 999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.nav__overlay.open {
  display: flex;
  opacity: 1;
  pointer-events: all;
}

.nav__overlay .nav__link {
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .nav__links {
    display: none;
  }
  .nav__hamburger {
    display: flex;
  }
  .nav__inner {
    padding: 0 1rem;
  }
}


/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: 100px;
  transition: transform 0.16s ease-out, box-shadow 0.2s ease, background 0.2s ease;
  text-decoration: none;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.btn--amber {
  background: var(--accent);
  color: #fff;
}

@media (hover: hover) and (pointer: fine) {
  .btn--amber:hover {
    color: #fff;
    transform: scale(1.03);
    box-shadow: 0 4px 20px rgba(59,130,246,0.3);
  }
}

.btn--ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.15);
}

@media (hover: hover) and (pointer: fine) {
  .btn--ghost:hover {
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
  }
}

.btn__arrow {
  transition: transform 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover .btn__arrow {
    transform: translateX(3px);
  }
}

.btn:active {
  transform: scale(0.97);
}


/* ============================================================
   SCROLL REVEAL — GSAP-driven (opacity/transform only)
   ============================================================ */
/* Progressive enhancement: visible by default, GSAP hides via gsap.set() */
.reveal {
  opacity: 1;
  transform: none;
}


/* ============================================================
   CHEVRON NUDGE — capability panel
   ============================================================ */
@media (hover: hover) and (pointer: fine) {
  .group:hover .chevron-nudge {
    transform: translateX(3px);
    color: white;
    transition: transform 0.2s ease;
  }
}


/* ============================================================
   TEXT DYNAMIC — hero video colour transitions
   Three-phase system: light → transitioning → dark
   hero-engine.js sets data-hero-phase on <body>
   ============================================================ */

/* Base transitions */
.text-dynamic {
  transition: color 600ms ease;
}
.text-dynamic-subtle {
  transition: color 600ms ease;
}
.text-dynamic-muted {
  transition: color 600ms ease;
}
.badge-dynamic {
  transition: border-color 600ms ease, background-color 600ms ease;
}
.glass-dynamic {
  transition: background-color 600ms ease, border-color 600ms ease, color 600ms ease;
}

/* Light phase (0-55%): white text on dark video */
[data-hero-phase="light"] .text-dynamic {
  color: #ffffff;
}
[data-hero-phase="light"] .text-dynamic-subtle {
  color: rgba(255,255,255,0.8);
}
[data-hero-phase="light"] .text-dynamic-muted {
  color: rgba(255,255,255,0.6);
}
[data-hero-phase="light"] .glass-dynamic {
  background-color: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.15);
}
[data-hero-phase="light"] .badge-dynamic {
  border-left-color: #ffffff;
}

/* Transitioning phase (55-85%): dark text + shadow */
[data-hero-phase="transitioning"] .text-dynamic {
  color: #333333;
  text-shadow: 0 1px 3px rgba(255,255,255,0.3);
}
[data-hero-phase="transitioning"] .text-dynamic-subtle {
  color: rgba(50,50,50,0.85);
}
[data-hero-phase="transitioning"] .text-dynamic-muted {
  color: rgba(50,50,50,0.6);
}
[data-hero-phase="transitioning"] .badge-dynamic {
  border-left-color: #ffffff;
}

/* Dark phase (85-100%): dark text on white background */
[data-hero-phase="dark"] .text-dynamic {
  color: #0a0a0a;
}
[data-hero-phase="dark"] .text-dynamic-subtle {
  color: rgba(10,10,10,0.8);
}
[data-hero-phase="dark"] .text-dynamic-muted {
  color: rgba(10,10,10,0.55);
}
[data-hero-phase="dark"] .glass-dynamic {
  background-color: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.1);
}
[data-hero-phase="dark"] .badge-dynamic {
  border-left-color: #0a0a0a;
}

/* CTA buttons adapt to dark phase */
[data-hero-phase="dark"] .cta-primary {
  background-color: #0a0a0a;
  color: #ffffff;
}
[data-hero-phase="dark"] .cta-secondary {
  border-color: rgba(10,10,10,0.25);
  color: #0a0a0a;
  background-color: rgba(10,10,10,0.06);
}


/* ============================================================
   MARQUEE — CSS infinite scroll
   ============================================================ */
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.animate-marquee {
  animation: marquee 40s linear infinite;
}

/* Marquee overflow containment (Issue #5) */
.marquee-container {
  overflow-x: hidden;
}


/* ============================================================
   CANVAS / VIDEO — GPU acceleration
   ============================================================ */
#video-canvas {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  opacity: 0.7;
}

#video-canvas.canvas-ready {
  opacity: 1 !important;
}

#video-poster,
#video-source {
  transition: opacity 500ms ease;
}

/* Glass elements: GPU acceleration */
.bg-white\/15,
.bg-white\/10,
.backdrop-blur-md {
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* Content-visibility optimisation for off-screen sections */
section {
  content-visibility: auto;
  contain-intrinsic-size: auto 100vh;
}

/* iOS 100vh fix */
@supports (-webkit-touch-callout: none) {
  .min-h-\[100dvh\] {
    min-height: -webkit-fill-available;
  }
}


/* ============================================================
   FORM FOCUS STATES
   ============================================================ */
input:focus,
textarea:focus {
  outline: none;
}

::placeholder {
  color: rgba(255,255,255,0.3);
}


/* ============================================================
   MOTION BACKGROUND SYSTEM — Particles + Ripples + Glows
   ============================================================ */

/* Slow spin for About concentric rings (Section 6) */


/* Click ripple */

/* Stat glow (Section 3) */

/* Card left-border accent (Section 4) */
@media (hover: hover) and (pointer: fine) {
    border-left-color: rgba(59, 130, 246, 0.4);
  }
}

/* Process step indicator dot (Section 5) */

/* Section 7 CTA heading ambient glow */
.cta-glow {
  text-shadow: 0 0 40px rgba(59, 130, 246, 0.10);
}

/* Footer 360 logo blue glow */

/* ============================================================
   SECTION BACKGROUND TRANSITIONS — Visual rhythm
   Alternating light/dark creates "chapters" (Apple pattern)
   ============================================================ */

/* White-to-black gradient at top of dark sections following white */
.gradient-from-white {
  background: linear-gradient(to bottom, #ffffff 0%, rgba(10,10,10,0.92) 400px), rgba(10,10,10,0.92);
  background-attachment: scroll;
}

/* Off-white-to-black gradient at top of dark sections following off-white */
.gradient-from-warm {
  background: linear-gradient(to bottom, #f5f5f5 0%, rgba(10,10,10,0.92) 400px), rgba(10,10,10,0.92);
  background-attachment: scroll;
}

/* ============================================================
   SELECTION
   ============================================================ */
::selection {
  background: rgba(59,130,246,0.3);
  color: var(--text-primary);
}


/* ============================================================
   VIEW TRANSITIONS
   ============================================================ */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: fade-out 0.25s ease-out;
}

::view-transition-new(root) {
  animation: fade-in 0.3s ease-out;
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}


/* ============================================================
   REDUCED MOTION — full fallback
   ============================================================ */
@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;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .animate-marquee {
    animation: none;
    flex-wrap: wrap;
    justify-content: center;
  }

  #video-canvas {
    display: none;
  }
  #video-poster {
    opacity: 1 !important;
  }
}

/* ============================================================
   GRADIENT SPOTLIGHT — Mouse-following ambient light
   ============================================================ */
.gradient-spotlight {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.6s ease;
  background: radial-gradient(
    600px circle at var(--spot-x, 50%) var(--spot-y, 50%),
    rgba(59, 130, 246, 0.15) 0%,
    rgba(59, 130, 246, 0.06) 30%,
    rgba(59, 130, 246, 0.02) 55%,
    transparent 70%
  );
  mix-blend-mode: screen;
}
.gradient-spotlight--active {
  opacity: 1;
}

/* ============================================================
   CLICK GRADIENT PULSE — Smooth expanding ring
   ============================================================ */
.gradient-pulse {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(59, 130, 246, 0.28) 0%,
    rgba(59, 130, 246, 0.08) 35%,
    transparent 70%
  );
  animation: pulse-out 0.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}
@keyframes pulse-out {
  0% { transform: scale(0.3); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* ============================================================
   ENHANCED GRADIENT TRANSITIONS — Animated blue accent
   ============================================================ */
.gradient-from-white {
  background:
    radial-gradient(ellipse at 20% 30%, rgba(59,130,246,0.07) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(59,130,246,0.05) 0%, transparent 50%),
    linear-gradient(to bottom, #ffffff 0%, #0a0a0a 500px),
    #0a0a0a;
  background-attachment: scroll;
  animation: gradient-shift 12s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

.gradient-from-warm {
  background:
    radial-gradient(ellipse at 80% 20%, rgba(59,130,246,0.07) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 80%, rgba(59,130,246,0.05) 0%, transparent 50%),
    linear-gradient(to bottom, #f5f5f5 0%, #0a0a0a 500px),
    #0a0a0a;
  background-attachment: scroll;
  animation: gradient-shift-alt 14s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 0%, 100% 100%, 0% 0%; }
  50% { background-position: 8% 5%, 92% 95%, 0% 0%; }
}
@keyframes gradient-shift-alt {
  0%, 100% { background-position: 100% 0%, 0% 100%, 0% 0%; }
  50% { background-position: 92% 8%, 8% 92%, 0% 0%; }
}
