/* ============================================
   MENA — Global Styles
   Post-XaaS. Outcome-Native. No Excuses.
   ============================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

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

ul,
ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ---------- CSS Variables ---------- */
:root {
  /* Surfaces */
  --surface: #0a0a0b;
  --surface-elevated: #141416;
  --surface-border: #1f1f23;

  /* Text */
  --text-primary: #fafafa;
  --text-secondary: #6b6b6b;
  --text-muted: #3d3d3d;

  /* Accent */
  --accent: #ff3d00;
  --accent-muted: #ff3d0020;
  --accent-hover: #ff5722;

  /* Status */
  --success: #00ff88;
  --success-muted: #00ff8820;
  --warning: #ffaa00;
  --error: #ff3333;

  /* Easing */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-in-out-circ: cubic-bezier(0.85, 0, 0.15, 1);

  /* Spacing */
  --space-xs: clamp(0.25rem, 0.5vw, 0.5rem);
  --space-sm: clamp(0.5rem, 1vw, 1rem);
  --space-md: clamp(1rem, 2vw, 2rem);
  --space-lg: clamp(2rem, 4vw, 4rem);
  --space-xl: clamp(4rem, 8vw, 8rem);
  --space-2xl: clamp(6rem, 12vw, 12rem);

  /* Layout */
  --container-max: 1400px;
  --container-padding: clamp(1rem, 4vw, 3rem);

  /* Grid */
  --grid-gap: clamp(1rem, 3vw, 3rem);
}

/* ---------- Base Styles ---------- */
body {
  font-family: var(--font-body);
  background-color: var(--surface);
  color: var(--text-primary);
}

::selection {
  background-color: var(--accent);
  color: var(--surface);
}

/* ---------- Utility Classes ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--grid-gap);
}

/* ---------- Focus States ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- 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;
  }
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--surface-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ---------- Animated Background - Subtle Grid Pulse ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(255, 61, 0, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(255, 61, 0, 0.02) 0%, transparent 50%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 100px,
      rgba(255, 61, 0, 0.01) 100px,
      rgba(255, 61, 0, 0.01) 101px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 100px,
      rgba(255, 61, 0, 0.01) 100px,
      rgba(255, 61, 0, 0.01) 101px
    );
  pointer-events: none;
  z-index: -1;
  animation: bg-drift 30s ease-in-out infinite;
}

@keyframes bg-drift {
  0%, 100% { opacity: 0.5; transform: translateY(0); }
  50% { opacity: 0.8; transform: translateY(-20px); }
}

/* Floating accent orb */
body::after {
  content: '';
  position: fixed;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255, 61, 0, 0.04) 0%, transparent 70%);
  border-radius: 50%;
  top: 30%;
  right: -200px;
  pointer-events: none;
  z-index: -1;
  animation: orb-float 20s ease-in-out infinite;
}

@keyframes orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-100px, 50px) scale(1.1); }
  66% { transform: translate(-50px, -30px) scale(0.95); }
}


/* ==========================================================================
   POWER WIRES BACKGROUND
   ========================================================================== */

.power-wires-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1; /* Above background, below content */
  opacity: 1;
}

/* Ensure sections don't block the canvas */
section {
  position: relative;
  z-index: 2;
  background: transparent !important; /* Let wires show through */
}

/* Only hero keeps its background */
.hero {
  background: var(--surface) !important;
}

/* CTA section gets special treatment - wire destination */
.cta-section {
  position: relative;
  z-index: 3;
  background: transparent !important;
}

.cta-section::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255, 61, 0, var(--power-intensity, 0)) 0%, transparent 70%);
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: -1;
}

/* Button power-up effect */
.cta-button.is-powered {
  animation: power-pulse 1.5s ease-in-out infinite;
  box-shadow:
    0 0 20px rgba(255, 61, 0, 0.5),
    0 0 40px rgba(255, 61, 0, 0.3),
    0 0 60px rgba(255, 61, 0, 0.2);
}

@keyframes power-pulse {
  0%, 100% {
    box-shadow:
      0 0 20px rgba(255, 61, 0, 0.5),
      0 0 40px rgba(255, 61, 0, 0.3),
      0 0 60px rgba(255, 61, 0, 0.2);
  }
  50% {
    box-shadow:
      0 0 30px rgba(255, 61, 0, 0.7),
      0 0 60px rgba(255, 61, 0, 0.5),
      0 0 100px rgba(255, 61, 0, 0.3);
  }
}

/* Wire endpoint nodes along the sides */
.wire-node {
  position: fixed;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  opacity: var(--node-opacity, 0.3);
  box-shadow: 0 0 calc(var(--node-glow, 5) * 1px) var(--accent);
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.3s ease, box-shadow 0.3s ease;
}

/* ---------- Logo Image ---------- */
.logo-img {
  height: 32px;
  width: auto;
  display: block;
}

.footer .logo-img,
.footer-logo .logo-img {
  height: 74px;
}

/* ---------- Aqel Attribution ---------- */
.aqel-attribution {
  padding: 0.25rem var(--container-padding) var(--space-md);
  text-align: center;
  background: var(--surface);
}

.aqel-attribution a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  transition: color 0.2s ease;
}

.aqel-attribution a:hover {
  color: var(--text-secondary);
}

.aqel-attribution .aqel-logo {
  height: 20px;
  width: auto;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.aqel-attribution a:hover .aqel-logo {
  opacity: 0.7;
}
