/* ═══════════════════════════════════════════════════════════════
   QTSI — global.css
   Design by NEXORA (nexorayyc.io)
   Brand: Blue #0070F3 · Green #5DB937 · Dark Graphite #0A0A0F
═══════════════════════════════════════════════════════════════ */

/* ── 1. Design Tokens ─────────────────────────────────────── */
:root {
  /* Brand */
  --blue:          #0070F3;
  --blue-light:    #3B9EFF;
  --blue-dark:     #0052CC;
  --green:         #5DB937;
  --green-light:   #7DD44F;
  --green-dark:    #3D8A1F;

  /* Gradients */
  --grad-brand:   linear-gradient(135deg, #0070F3 0%, #5DB937 100%);
  --grad-brand-r: linear-gradient(135deg, #5DB937 0%, #0070F3 100%);

  /* Backgrounds — never pure black (OLED smear) */
  --bg-void:       #07070C;
  --bg-base:       #0A0A0F;
  --bg-raised:     #0F0F18;
  --bg-elevated:   #141421;
  --bg-surface:    rgba(255,255,255,.04);
  --bg-surface-md: rgba(255,255,255,.07);
  --bg-surface-hi: rgba(255,255,255,.11);

  /* Text — all pass 4.5:1 on --bg-base */
  --text-primary:   #F0F2F5;   /* 14.8:1 */
  --text-secondary: #94A3B8;   /* 5.2:1  */
  --text-muted:     #606878;   /* 3.1:1 — decorative / large text only */
  --text-inverse:   #0A0A0F;

  /* Borders */
  --border:       rgba(255,255,255,.08);
  --border-md:    rgba(255,255,255,.13);
  --border-hi:    rgba(255,255,255,.20);
  --border-blue:  rgba(0,112,243,.38);
  --border-green: rgba(93,185,55,.32);

  /* Glassmorphism */
  --glass-bg:     rgba(12,12,20,.80);
  --glass-border: rgba(255,255,255,.10);

  /* Shadows */
  --shadow-sm:    0 1px 4px rgba(0,0,0,.55);
  --shadow-md:    0 4px 24px rgba(0,0,0,.60);
  --shadow-lg:    0 16px 56px rgba(0,0,0,.70);
  --shadow-blue:  0 0 48px rgba(0,112,243,.28);
  --shadow-green: 0 0 48px rgba(93,185,55,.22);
  --shadow-brand: 0 0 72px rgba(0,112,243,.22), 0 0 140px rgba(93,185,55,.14);

  /* Radius */
  --r-xs:   4px;
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-2xl:  32px;
  --r-full: 9999px;

  /* Spacing (8pt grid) */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;
  --sp-24: 96px;
  --sp-32: 128px;

  /* Section rhythm */
  --section-py:    clamp(80px, 10vw, 128px);
  --container-max: 1280px;
  --container-pad: clamp(24px, 5vw, 80px);

  /* Type scale — raw values so clamp() works everywhere */
  --text-xs:   0.75rem;    /*  12px */
  --text-sm:   0.875rem;   /*  14px */
  --text-base: 1rem;       /*  16px */
  --text-lg:   1.125rem;   /*  18px */
  --text-xl:   1.25rem;    /*  20px */
  --text-2xl:  1.5rem;     /*  24px */
  --text-3xl:  1.875rem;   /*  30px */
  --text-4xl:  2.25rem;    /*  36px */
  --text-5xl:  3rem;       /*  48px */
  --text-6xl:  3.75rem;    /*  60px */
  --text-7xl:  4.5rem;     /*  72px */
  --text-8xl:  6rem;       /*  96px */

  /* Easing */
  --ease-expo:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Duration */
  --dur-fast:   150ms;
  --dur-base:   250ms;
  --dur-slow:   400ms;
  --dur-slower: 600ms;

  /* Z-index layers */
  --z-raised:  10;
  --z-overlay: 40;
  --z-modal:   100;
  --z-nav:     200;
  --z-copilot: 300;
  --z-toast:   400;
}

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

html {
  font-size: 16px;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: dark;
  /* overflow-x here, NOT on body — keeps position:sticky working. The
     off-canvas mobile drawer is hidden via opacity/visibility (see
     .nav-mobile) rather than an off-screen translate, so nothing overflows. */
  overflow-x: hidden;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
  /* no overflow-x here — breaks sticky nav */
}

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

a { color: inherit; text-decoration: none; }
/* Underline only on body-copy links for readability */
p a, li a:not(.btn):not(.nav-links a):not(.footer-col a):not(.footer-contact-item) {
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,.2);
  text-underline-offset: 3px;
  transition: text-decoration-color 200ms;
}
p a:hover { color: var(--blue-light); text-decoration-color: var(--blue-light); }

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

ul, ol { list-style: none; }

/* Touch targets — only on standalone interactive controls, NOT inline <a> */
button,
[role="button"],
input[type="submit"],
input[type="button"],
input[type="reset"] {
  min-height: 44px;
  min-width: 44px;
}
/* Nav/card CTAs get touch targets via their own padding; inline text links are exempt */

/* ── 3. Typography ────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* Use raw px values in clamp — never CSS vars as min/max */
.display-xl {
  font-size: clamp(2.75rem, 6vw, 6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.display-lg {
  font-size: clamp(2.2rem, 5vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.display-md {
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.12;
}

.display-sm {
  font-size: clamp(1.4rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.body-lg  { font-size: 1.125rem; line-height: 1.75; }
.body-md  { font-size: 1rem;     line-height: 1.75; }
.body-sm  { font-size: 0.875rem; line-height: 1.7; }
.label    { font-size: 0.75rem;  font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.caption  { font-size: 0.75rem;  color: var(--text-muted); }

/* Gradient text utility */
.text-gradient,
.text-gradient-r {
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* paint-order prevents clipping at descenders */
  padding-bottom: 0.05em;
}
.text-gradient   { background-image: var(--grad-brand); }
.text-gradient-r { background-image: var(--grad-brand-r); }

.text-blue  { color: var(--blue-light); }  /* lighter for dark bg contrast */
.text-green { color: var(--green-light); }
.text-muted { color: var(--text-secondary); }

/* ── 4. Layout ────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section {
  padding-block: var(--section-py);
  position: relative;
  /* No overflow:hidden here — it breaks sticky children & clips blobs.
     Apply .section-clip to specific sections that need it. */
}

.section-clip { overflow: hidden; }

.section--dark     { background: var(--bg-base); }
.section--raised   { background: var(--bg-raised); }
.section--elevated { background: var(--bg-elevated); }

/* Section header */
.section-header {
  text-align: center;
  max-width: 760px;
  margin-inline: auto;
  margin-bottom: var(--sp-16);
}

/* Sub-copy beneath any section heading — standardised spacing */
.section-header .body-lg,
.section-header .body-md {
  margin-top: var(--sp-5);
  max-width: 660px;
  margin-inline: auto;
}

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue-light);
  margin-bottom: var(--sp-4);
  padding: 6px 14px;
  border: 1px solid var(--border-blue);
  border-radius: var(--r-full);
  background: rgba(0,112,243,.08);
  /* Ensure legibility — passes 4.5:1 on dark bg */
}

.section-eyebrow--green {
  color: var(--green-light);
  border-color: var(--border-green);
  background: rgba(93,185,55,.08);
}

/* ── 5. Grid helpers ─────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-8); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-6); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-4,
  .grid-3,
  .grid-2 { grid-template-columns: 1fr; }
}

/* Flex helpers */
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.stack        { display: flex; flex-direction: column; }
.gap-2 { gap: var(--sp-2); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }

/* ── 6. Ambient blobs ────────────────────────────────────── */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  /* will-change only while animating — added via JS */
}

.blob--blue  { background: radial-gradient(circle, rgba(0,112,243,.20) 0%, transparent 70%); }
.blob--green { background: radial-gradient(circle, rgba(93,185,55,.16) 0%, transparent 70%); }

/* ── 7. Divider ──────────────────────────────────────────── */
.divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--border-md) 50%, transparent 100%);
  border: none;
}

/* Section-to-section brand gradient separator line */
.section + .section::before,
.section + #trust-bar::before {
  content: '';
  display: block;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--border) 30%, var(--border) 70%, transparent 100%);
  margin-inline: var(--container-pad);
}

/* ── 8. Scroll-reveal ────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity   var(--dur-slower) var(--ease-expo),
    transform var(--dur-slower) var(--ease-expo);
}

/* Directional variants — each sets its own transform */
.reveal--up    { transform: translateY(28px); }
.reveal--left  { transform: translateX(-28px); }
.reveal--right { transform: translateX(28px); }
.reveal--scale { transform: scale(0.94) translateY(16px); }

/* All variants resolve to identity */
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Stagger delays */
.delay-1 { transition-delay:  80ms; }
.delay-2 { transition-delay: 160ms; }
.delay-3 { transition-delay: 240ms; }
.delay-4 { transition-delay: 320ms; }
.delay-5 { transition-delay: 400ms; }
.delay-6 { transition-delay: 480ms; }

/* ── 9. Accessibility ────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--blue-light);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* Remove default outline only when focus-visible is supported */
:focus:not(:focus-visible) { outline: none; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

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

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

  /* Prevent blobs from animating */
  .blob { animation: none !important; }
}

/* Performance: allow browser to skip off-screen section paint */
.section {
  content-visibility: auto;
  contain-intrinsic-size: 0 600px;
}

/* Always-visible elements — don't defer these */
#hero,
#trust-bar,
#site-nav { content-visibility: visible; contain-intrinsic-size: none; }

/* ── 10. Print baseline ──────────────────────────────────── */
@media print {
  body { background: #fff; color: #000; }
  .blob, canvas { display: none; }
}
