/* PurpleMESH — site.css
   Shared base styles for every page. Loaded once. */

/* ------------------------------------------------------------------
   1. Typography
   - Body copy: system sans (fast, readable, no extra font request)
   - Headings, eyebrows, labels, buttons, inputs, stats: JetBrains Mono
   ------------------------------------------------------------------ */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --color-brand: #7C3AED;
  --color-brand-hover: #6D28D9;
  --color-dark: #0A0A0A;
}

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.font-mono,
.uppercase,
button,
input, select, textarea,
code, pre,
nav {
  font-family: var(--font-mono);
}

/* ------------------------------------------------------------------
   2. Header (fixed; injected by JS but reserved here to avoid FOUC)
   ------------------------------------------------------------------ */

#site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 50;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.header-scrolled {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

/* Transparent header sits over dark hero: light text, subtle scrim so
   hero body text never reads through the chrome */
.header-transparent {
  background: linear-gradient(to bottom, rgba(10, 10, 10, 0.55) 0%, rgba(10, 10, 10, 0) 100%);
}

.header-transparent .nav-link,
.header-transparent .nav-dropdown-btn {
  color: #ffffff;
}
.header-transparent .nav-link:hover,
.header-transparent .nav-dropdown-btn:hover {
  color: var(--color-brand);
}
.header-transparent #menu-toggle {
  color: #ffffff;
}

/* ------------------------------------------------------------------
   3. Footer (JS-injected) — reserve height to avoid CLS pop-in
   ------------------------------------------------------------------ */

#site-footer {
  min-height: 28rem;
  background: var(--color-dark);
  display: block;
}

/* ------------------------------------------------------------------
   4. Dropdown menu (nav)
   ------------------------------------------------------------------ */

.nav-dropdown-menu {
  top: 100%;
  min-width: 260px;
}

/* ------------------------------------------------------------------
   5. Scroll-reveal animations
   - .reveal: single element fades up on intersect
   - .stagger-children > *: children fade up sequentially via CSS delay
   ------------------------------------------------------------------ */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.stagger-children > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.stagger-children.revealed > *:nth-child(1)  { transition-delay: 0ms;   }
.stagger-children.revealed > *:nth-child(2)  { transition-delay: 80ms;  }
.stagger-children.revealed > *:nth-child(3)  { transition-delay: 160ms; }
.stagger-children.revealed > *:nth-child(4)  { transition-delay: 240ms; }
.stagger-children.revealed > *:nth-child(5)  { transition-delay: 320ms; }
.stagger-children.revealed > *:nth-child(6)  { transition-delay: 400ms; }
.stagger-children.revealed > *:nth-child(7)  { transition-delay: 480ms; }
.stagger-children.revealed > *:nth-child(8)  { transition-delay: 560ms; }
.stagger-children.revealed > * {
  opacity: 1;
  transform: translateY(0);
}

/* ------------------------------------------------------------------
   6. Mobile nav — slide-in with backdrop and animation
   ------------------------------------------------------------------ */

#mobile-nav {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
#mobile-nav.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ------------------------------------------------------------------
   7. CTA polish — arrow nudge on hover for elements with .cta-arrow
   Apply class to inline-arrow CTAs to get a subtle micro-interaction.
   ------------------------------------------------------------------ */

.cta-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}
.group:hover .cta-arrow,
a:hover .cta-arrow,
button:hover .cta-arrow {
  transform: translateX(4px);
}

/* Primary brand button gets a soft brand-tinted glow on hover */
.btn-primary {
  position: relative;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.btn-primary:hover {
  box-shadow: 0 8px 24px -8px rgba(124, 58, 237, 0.55);
  transform: translateY(-1px);
}

/* ------------------------------------------------------------------
   8. Accessibility
   - Focus-visible: brand-colored outline for keyboard users only
   - Skip-to-content link: hidden until focused
   ------------------------------------------------------------------ */

:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
  border-radius: 2px;
}
:focus:not(:focus-visible) {
  outline: none;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--color-brand);
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 2px;
  z-index: 1000;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 1rem;
}

/* Back-to-top button — hidden until the user has scrolled past the fold */
.back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  /* Respect iOS home-indicator safe area */
  bottom: max(1.5rem, env(safe-area-inset-bottom, 1.5rem));
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--color-brand);
  color: #ffffff;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, background-color 0.15s ease;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}
.back-to-top:hover {
  background: var(--color-brand-hover);
}
.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top svg {
  width: 20px;
  height: 20px;
  pointer-events: none; /* clicks pass through to the button */
}
@media (max-width: 640px) {
  .back-to-top {
    right: 1rem;
    bottom: 1rem;
    bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
    width: 40px;
    height: 40px;
  }
  .back-to-top svg { width: 18px; height: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .back-to-top,
  .back-to-top.is-visible {
    transform: none;
    transition: opacity 0.01s linear, background-color 0.01s linear;
  }
}

/* ------------------------------------------------------------------
   9. Smooth scroll for anchor links (services page uses it heavily)
   ------------------------------------------------------------------ */

html {
  scroll-behavior: smooth;
}

/* ------------------------------------------------------------------
   10. Reduced motion — respect user preference
   ------------------------------------------------------------------ */

@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,
  .stagger-children > * {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ------------------------------------------------------------------
   11. Hero visual treatment — aurora orbs + grid mesh
   - Multi-layer composition: dotted grid base + drifting gradient orbs
   - All pure CSS, GPU-accelerated, respects reduced-motion
   ------------------------------------------------------------------ */

.hero-dark {
  background-color: var(--color-dark);
  background-image:
    radial-gradient(rgba(124, 58, 237, 0.16) 1px, transparent 1px),
    radial-gradient(rgba(124, 58, 237, 0.10) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: 0 0, 28px 28px;
}

/* Aurora container — sits behind everything */
.hero-aurora {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.aurora-orb {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(50px);
  mix-blend-mode: screen; /* additive blending → orbs glow brighter on dark */
  will-change: transform;
}

.aurora-orb--1 {
  width: 760px;
  height: 760px;
  top: -120px;
  right: -60px;
  background: radial-gradient(circle, #A855F7 0%, rgba(168, 85, 247, 0.4) 35%, rgba(124, 58, 237, 0) 70%);
  animation: aurora-drift-1 22s ease-in-out infinite alternate;
}

.aurora-orb--2 {
  width: 600px;
  height: 600px;
  bottom: -120px;
  left: -60px;
  background: radial-gradient(circle, #6D28D9 0%, rgba(109, 40, 217, 0.5) 35%, rgba(76, 29, 149, 0) 70%);
  animation: aurora-drift-2 28s ease-in-out infinite alternate;
}

.aurora-orb--3 {
  width: 480px;
  height: 480px;
  top: 20%;
  left: 35%;
  background: radial-gradient(circle, #C4B5FD 0%, rgba(196, 181, 253, 0.4) 35%, rgba(168, 85, 247, 0) 70%);
  animation: aurora-drift-3 32s ease-in-out infinite alternate;
}

/* Hot magenta accent — adds depth and color variation */
.aurora-orb--4 {
  width: 380px;
  height: 380px;
  top: 55%;
  right: 25%;
  background: radial-gradient(circle, #EC4899 0%, rgba(236, 72, 153, 0.3) 35%, rgba(236, 72, 153, 0) 70%);
  animation: aurora-drift-3 26s ease-in-out infinite alternate-reverse;
}

@keyframes aurora-drift-1 {
  0%   { transform: translate(0, 0) scale(1);     }
  100% { transform: translate(-60px, 60px) scale(1.12); }
}
@keyframes aurora-drift-2 {
  0%   { transform: translate(0, 0) scale(1);     }
  100% { transform: translate(80px, -50px) scale(0.92); }
}
@keyframes aurora-drift-3 {
  0%   { transform: translate(0, 0) scale(1);     }
  100% { transform: translate(-50px, -70px) scale(1.05); }
}

/* Stylized mesh node-graph illustration — bottom-right corner, decorative
   Sits in the homepage hero. Positioning mirrors .hero-decor on inner pages
   so the visual rhythm is consistent across the site. */
.hero-mesh-svg {
  position: absolute;
  bottom: 40px;
  right: 6vw;
  width: 460px;
  height: 460px;
  opacity: 0.4;
  pointer-events: none;
  z-index: 2;
  animation: mesh-rotate 60s linear infinite;
}
.hero-mesh-svg circle { fill: #C4B5FD; }
.hero-mesh-svg line   { stroke: #A855F7; stroke-width: 1.5; }

/* Grow with viewport so the mesh stays proportional to the hero canvas */
@media (min-width: 1024px) {
  .hero-mesh-svg {
    width: 540px;
    height: 540px;
    right: 8vw;
    bottom: 60px;
  }
}
@media (min-width: 1440px) {
  .hero-mesh-svg {
    width: 620px;
    height: 620px;
    right: 10vw;
  }
}

/* Hide on small screens so the hero stays uncluttered (mirrors .hero-decor) */
@media (max-width: 640px) {
  .hero-mesh-svg { display: none; }
}

@keyframes mesh-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Legacy single-glow class kept as alias — old markup still works */
.hero-glow {
  position: absolute;
  pointer-events: none;
  width: 720px;
  height: 720px;
  border-radius: 50%;
  top: -160px;
  right: -160px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.35) 0%, rgba(124, 58, 237, 0) 60%);
  filter: blur(40px);
  z-index: 0;
  animation: aurora-drift-1 18s ease-in-out infinite alternate;
}

/* Page-specific decorative SVG — illustrates the page topic
   Positioned in the bottom-right corner of inner heroes with clear margin */
.hero-decor {
  position: absolute;
  bottom: 40px;
  right: 6vw;
  width: 400px;
  height: 400px;
  opacity: 0.65;
  pointer-events: none;
  z-index: 2;
}

/* Larger screens get a bigger illustration with even more breathing room */
@media (min-width: 1024px) {
  .hero-decor {
    width: 460px;
    height: 460px;
    right: 8vw;
    bottom: 60px;
  }
}

@media (min-width: 1440px) {
  .hero-decor {
    width: 520px;
    height: 520px;
    right: 10vw;
  }
}

.hero-decor--float {
  animation: hero-decor-float 14s ease-in-out infinite alternate;
}

@keyframes hero-decor-float {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(-14px, -10px); }
}

/* Hide on mobile so the hero stays uncluttered */
@media (max-width: 640px) {
  .hero-decor { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .aurora-orb,
  .hero-glow,
  .hero-mesh-svg,
  .hero-decor--float { animation: none; }
}

/* ------------------------------------------------------------------
   11b. Eyebrow accent — small brand bar before section labels
   Apply with .eyebrow-accent on the "01 — PRODUCTS" style paragraphs
   ------------------------------------------------------------------ */

.eyebrow-accent {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
}
.eyebrow-accent::before {
  content: '';
  display: inline-block;
  width: 1.5rem;
  height: 2px;
  background: var(--color-brand);
}

/* ------------------------------------------------------------------
   11b-anim. Hero-decoration sub-element animations
   Apply these classes to specific elements inside hero illustrations
   for layered motion (in addition to .hero-decor--float on the parent).
   Reduced-motion is honored globally by §10's media query.
   ------------------------------------------------------------------ */

/* Opacity pulse — for "active" indicators (nodes, dots, QR pixels) */
@keyframes hero-anim-pulse {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 1; }
}
.hero-anim-pulse        { animation: hero-anim-pulse 2.4s ease-in-out infinite; }
.hero-anim-pulse--d1    { animation-delay: 0.3s; }
.hero-anim-pulse--d2    { animation-delay: 0.6s; }
.hero-anim-pulse--d3    { animation-delay: 0.9s; }
.hero-anim-pulse--d4    { animation-delay: 1.2s; }
.hero-anim-pulse--d5    { animation-delay: 1.5s; }
.hero-anim-pulse--d6    { animation-delay: 1.8s; }

/* Slow rotation — for orbital rings, satellites
   Set inline `style="transform-box: view-box; transform-origin: <cx>px <cy>px;"`
   on the rotating <g> so the spin pivot is at the SVG point you want. */
@keyframes hero-anim-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.hero-anim-spin           { animation: hero-anim-spin 60s linear infinite; }
.hero-anim-spin--slow     { animation-duration: 90s; }
.hero-anim-spin--reverse  { animation-direction: reverse; }

/* Stroke-dash flow — for dashed connectors suggesting data movement */
@keyframes hero-anim-flow {
  to { stroke-dashoffset: -20; }
}
.hero-anim-flow { animation: hero-anim-flow 3s linear infinite; }

/* Gentle scale breathe — for verification badges, shields, key elements */
@keyframes hero-anim-breathe {
  0%, 100% { transform: scale(1);    }
  50%      { transform: scale(1.06); }
}
.hero-anim-breathe {
  transform-box: fill-box;
  transform-origin: center;
  animation: hero-anim-breathe 3.5s ease-in-out infinite;
}

/* ------------------------------------------------------------------
   11c. Card hover gradient glow — soft brand-tinted lift
   Add .card-glow to any product/service card for the effect
   ------------------------------------------------------------------ */

.card-glow {
  position: relative;
  isolation: isolate;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.3s ease;
}
.card-glow::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--glow-x, 50%) var(--glow-y, 0%),
                              rgba(124, 58, 237, 0.12) 0%,
                              transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: -1;
}
.card-glow:hover::before { opacity: 1; }
.card-glow:hover {
  box-shadow: 0 10px 30px -10px rgba(124, 58, 237, 0.25);
}

/* ------------------------------------------------------------------
   12. Form fields (used on contact page)
   ------------------------------------------------------------------ */

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 1px var(--color-brand);
}
