/* ============================================================
   Ni Source Technologies — Design System & Global Styles
   Premium Enterprise UI | Sky Blue #27A5FF Primary
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&amp;family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&amp;display=swap');

/* ─── Layer Order ─────────────────────────────────────────── */
@layer reset, base, theme, components, utilities, animations;

/* ─── Design Tokens ───────────────────────────────────────── */
:root {
  /* Primary Brand */
  --color-primary:        #27A5FF;
  --color-primary-dark:   #0E8AE8;
  --color-primary-light:  #6DC5FF;
  --color-primary-pale:   #EBF6FF;
  --color-primary-glow:   rgba(39, 165, 255, 0.3);
  --color-primary-glass:  rgba(39, 165, 255, 0.12);

  /* Dark & Navy */
  --color-dark:           #0A0F1E;
  --color-dark-2:         #0F1629;
  --color-dark-3:         #141E35;
  --color-dark-card:      rgba(15, 22, 41, 0.95);

  /* Neutrals */
  --color-white:          #FFFFFF;
  --color-off-white:      #F9FAFB;
  --color-section-bg:     #F5F7FA;
  --color-border:         #E2E8F0;
  --color-border-dark:    rgba(255, 255, 255, 0.08);

  /* Grays */
  --color-gray-50:        #F8FAFC;
  --color-gray-100:       #F1F5F9;
  --color-gray-200:       #E2E8F0;
  --color-gray-300:       #CBD5E1;
  --color-gray-400:       #94A3B8;
  --color-gray-500:       #64748B;
  --color-gray-600:       #475569;
  --color-gray-700:       #334155;
  --color-gray-800:       #1E293B;
  --color-gray-900:       #0F172A;

  /* Text */
  --color-text-primary:   #0F172A;
  --color-text-secondary: #475569;
  --color-text-muted:     #94A3B8;
  --color-text-light:     rgba(255, 255, 255, 0.85);
  --color-text-light-muted: rgba(255, 255, 255, 0.55);

  /* Accent Colors */
  --color-success:        #10B981;
  --color-warning:        #F59E0B;
  --color-error:          #EF4444;
  --color-purple:         #8B5CF6;
  --color-cyan:           #06B6D4;
  --color-orange:         #F97316;

  /* Gradients */
  --gradient-primary:     linear-gradient(135deg, #27A5FF 0%, #0E8AE8 50%, #1D4ED8 100%);
  --gradient-hero:        linear-gradient(135deg, #0A0F1E 0%, #0F1629 40%, #141E35 100%);
  --gradient-card:        linear-gradient(145deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
  --gradient-glow:        radial-gradient(ellipse at center, rgba(39, 165, 255, 0.15) 0%, transparent 70%);
  --gradient-cta:         linear-gradient(135deg, #0E8AE8 0%, #1D4ED8 50%, #5B21B6 100%);
  --gradient-text:        linear-gradient(90deg, #27A5FF 20%, #8B5CF6 60%, #EC4899 100%);
  --gradient-coral:       linear-gradient(135deg, #F97316 0%, #EF4444 100%);
  --gradient-emerald:     linear-gradient(135deg, #10B981 0%, #06B6D4 100%);
  --gradient-amber:       linear-gradient(135deg, #F59E0B 0%, #F97316 100%);
  --gradient-purple:      linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
  --gradient-mesh:        radial-gradient(ellipse 80% 80% at 20% 20%, rgba(39,165,255,0.15) 0%, transparent 50%),
                          radial-gradient(ellipse 60% 60% at 80% 80%, rgba(139,92,246,0.12) 0%, transparent 50%),
                          radial-gradient(ellipse 50% 50% at 50% 0%, rgba(236,72,153,0.08) 0%, transparent 50%);

  /* Glassmorphism */
  --glass-bg:             rgba(255, 255, 255, 0.07);
  --glass-bg-light:       rgba(255, 255, 255, 0.65);
  --glass-border:         rgba(255, 255, 255, 0.12);
  --glass-border-light:   rgba(255, 255, 255, 0.8);
  --glass-blur:           20px;
  --glass-blur-light:     12px;
  --glass-shadow:         0 8px 32px rgba(0, 0, 0, 0.2);
  --glass-shadow-light:   0 8px 32px rgba(0, 0, 0, 0.08);

  /* Typography Fonts */
  --font-primary:         'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display:         'Bricolage Grotesque', 'Plus Jakarta Sans', sans-serif;
  --font-heading:         'Bricolage Grotesque', 'Sora', sans-serif;
  --font-nav:             'Sora', 'Plus Jakarta Sans', sans-serif;
  --font-mono:            'JetBrains Mono', 'Fira Code', monospace;

  /* Font Sizes (fluid) */
  --text-xs:    clamp(0.7rem,  0.7rem  + 0.1vw, 0.75rem);
  --text-sm:    clamp(0.8rem,  0.8rem  + 0.15vw, 0.875rem);
  --text-base:  clamp(0.9rem,  0.875rem + 0.2vw, 1rem);
  --text-lg:    clamp(1rem,    0.95rem  + 0.25vw, 1.125rem);
  --text-xl:    clamp(1.1rem,  1rem     + 0.4vw, 1.25rem);
  --text-2xl:   clamp(1.25rem, 1.1rem   + 0.6vw, 1.5rem);
  --text-3xl:   clamp(1.5rem,  1.25rem  + 1vw, 1.875rem);
  --text-4xl:   clamp(1.875rem,1.5rem   + 1.5vw, 2.25rem);
  --text-5xl:   clamp(2.25rem, 1.75rem  + 2vw, 3rem);
  --text-6xl:   clamp(2.75rem, 2rem     + 2.5vw, 3.75rem);
  --text-7xl:   clamp(3rem,    2.25rem  + 3vw, 4.5rem);

  /* Font Weights */
  --fw-light:   300;
  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semi:    600;
  --fw-bold:    700;
  --fw-extra:   800;
  --fw-black:   900;

  /* Spacing */
  --space-1:   0.25rem;
  --space-2:   0.5rem;
  --space-3:   0.75rem;
  --space-4:   1rem;
  --space-5:   1.25rem;
  --space-6:   1.5rem;
  --space-8:   2rem;
  --space-10:  2.5rem;
  --space-12:  3rem;
  --space-16:  4rem;
  --space-20:  5rem;
  --space-24:  6rem;
  --space-32:  8rem;

  /* Border Radius */
  --radius-sm:   0.25rem;
  --radius-md:   0.5rem;
  --radius-lg:   0.75rem;
  --radius-xl:   1rem;
  --radius-2xl:  1.5rem;
  --radius-3xl:  2rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:    0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md:    0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg:    0 10px 30px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.06);
  --shadow-xl:    0 20px 60px rgba(0, 0, 0, 0.12), 0 8px 16px rgba(0, 0, 0, 0.08);
  --shadow-2xl:   0 32px 80px rgba(0, 0, 0, 0.16);
  --shadow-glow:  0 0 40px rgba(39, 165, 255, 0.25);
  --shadow-card:  0 2px 20px rgba(15, 23, 42, 0.08);
  --shadow-blue:  0 8px 32px rgba(39, 165, 255, 0.25);
  --shadow-purple:0 8px 32px rgba(139, 92, 246, 0.25);
  --shadow-card-hover: 0 24px 60px rgba(15, 23, 42, 0.14), 0 8px 24px rgba(39, 165, 255, 0.08);

  /* Transitions */
  --ease-out:     cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out:  cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --trans-fast:   150ms var(--ease-out);
  --trans-base:   250ms var(--ease-out);
  --trans-slow:   400ms var(--ease-out);
  --trans-slower: 600ms var(--ease-out);

  /* Z-index */
  --z-behind:    -1;
  --z-base:       0;
  --z-raised:     10;
  --z-dropdown:   100;
  --z-sticky:     200;
  --z-modal:      300;
  --z-toast:      400;
  --z-nav:        500;

  /* Layout */
  --container-max:  1280px;
  --container-wide: 1440px;
  --nav-height:     100px;
  --nav-height-sm:  80px;
}

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

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

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

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

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

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

  ul[class], ol[class] { list-style: none; }

  h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
    font-family: var(--font-display);
  }

  p { text-wrap: pretty; }
}

/* ─── Base ─────────────────────────────────────────────────── */
@layer base {
  body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--color-text-primary);
    background-color: var(--color-white);
    overflow-x: hidden;
  }

  ::selection {
    background-color: var(--color-primary);
    color: white;
  }

  :focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
  }

  /* Custom Scrollbar */
  ::-webkit-scrollbar { width: 6px; }
  ::-webkit-scrollbar-track { background: var(--color-section-bg); }
  ::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: var(--radius-full);
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--color-primary-dark); }

  a {
    transition: color var(--trans-fast);
  }

  a:hover { color: var(--color-primary); }
}

/* ─── Theme ────────────────────────────────────────────────── */
@layer theme {
  /* Container */
  .container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--space-6);
  }

  .container-wide {
    max-width: var(--container-wide);
    margin-inline: auto;
    padding-inline: var(--space-6);
  }

  /* Section Spacing */
  .section {
    padding-block: var(--space-24);
  }

  .section-sm {
    padding-block: var(--space-16);
  }

  .section-lg {
    padding-block: clamp(4rem, 8vw, 8rem);
  }

  /* Backgrounds */
  .bg-white        { background-color: var(--color-white); }
  .bg-section      { background-color: var(--color-section-bg); }
  .bg-dark         { background-color: var(--color-dark); color: var(--color-text-light); }
  .bg-dark-2       { background-color: var(--color-dark-2); }
  .bg-primary      { background: var(--gradient-primary); color: white; }

  /* Glassmorphism — Dark BG version */
  .glass-dark {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
  }

  /* Glassmorphism — Light BG version */
  .glass-light {
    background: var(--glass-bg-light);
    backdrop-filter: blur(var(--glass-blur-light));
    -webkit-backdrop-filter: blur(var(--glass-blur-light));
    border: 1px solid var(--glass-border-light);
    box-shadow: var(--glass-shadow-light);
  }

  /* Typography */
  .heading-display {
    font-family: var(--font-display);
    font-weight: var(--fw-extra);
    line-height: 1.1;
    letter-spacing: -0.03em;
  }

  .heading-xl  { font-size: var(--text-7xl); }
  .heading-lg  { font-size: var(--text-6xl); }
  .heading-md  { font-size: var(--text-5xl); }
  .heading-sm  { font-size: var(--text-4xl); }
  .heading-xs  { font-size: var(--text-3xl); }

  .text-gradient {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

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

  /* Section Labels */
  .section-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-4);
    background: var(--color-primary-glass);
    border: 1px solid rgba(39, 165, 255, 0.25);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--fw-semi);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-primary);
    margin-block-end: var(--space-5);
  }

  .section-label .dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    animation: pulse-dot 2s infinite;
  }

  /* Section Header */
  .section-header {
    text-align: center;
    max-width: 720px;
    margin-inline: auto;
    margin-block-end: var(--space-8);
  }

  .section-header .section-label {
    margin-block-end: var(--space-2) !important;
    margin-bottom: var(--space-2) !important;
  }

  .section-title {
    font-family: var(--font-display);
    font-size: var(--text-4xl);
    font-weight: 800;
    line-height: 1.1;
    color: var(--color-dark);
    margin-block-end: var(--space-2) !important;
    margin-bottom: var(--space-2) !important;
    margin-top: 0 !important;
    letter-spacing: -0.02em;
  }

  .section-subtitle {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    line-height: 1.7;
    max-width: 600px;
    margin-inline: auto;
    margin-top: 0 !important;
  }

  /* Dark section variants */
  .bg-dark .section-title { color: white; }
  .bg-dark .section-subtitle { color: var(--color-text-light-muted); }
}

/* ─── Utility Classes ──────────────────────────────────────── */
@layer utilities {
  /* Flex */
  .flex           { display: flex; }
  .flex-col       { flex-direction: column; }
  .items-center   { align-items: center; }
  .justify-center { justify-content: center; }
  .justify-between{ justify-content: space-between; }
  .gap-2          { gap: var(--space-2); }
  .gap-4          { gap: var(--space-4); }
  .gap-6          { gap: var(--space-6); }
  .gap-8          { gap: var(--space-8); }

  /* Grid */
  .grid          { display: grid; }
  .grid-auto-3   { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
  .grid-auto-2   { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); }

  /* Spacing */
  .mb-0  { margin-block-end: 0; }
  .mb-4  { margin-block-end: var(--space-4); }
  .mb-8  { margin-block-end: var(--space-8); }
  .mb-12 { margin-block-end: var(--space-12); }
  .mb-16 { margin-block-end: var(--space-16); }
  .mt-auto { margin-block-start: auto; }

  /* Text */
  .text-center  { text-align: center; }
  .text-left    { text-align: start; }
  .font-medium  { font-weight: var(--fw-medium); }
  .font-semi    { font-weight: var(--fw-semi); }
  .font-bold    { font-weight: var(--fw-bold); }

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

  /* Overflow */
  .overflow-hidden  { overflow: hidden; }
  .relative         { position: relative; }
  .absolute         { position: absolute; }
  .inset-0          { inset: 0; }
  .w-full           { width: 100%; }
  .h-full           { height: 100%; }

  /* Visibility for animation */
  .reveal-element {
    opacity: 0;
    transform: translateY(40px);
  }

  .reveal-element.is-visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  }
}

/* ─── Animations ──────────────────────────────────────────── */
@layer animations {
  @keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.8); }
  }

  @keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-12px); }
  }

  @keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 20px var(--color-primary-glow); }
    50% { box-shadow: 0 0 40px var(--color-primary-glow), 0 0 80px rgba(39,165,255,0.1); }
  }

  @keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
  }

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

  @keyframes fade-up {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
  }

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

  @keyframes slide-in-right {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
  }

  @keyframes count-up {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
  }

  @keyframes border-flow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
  }

  .animate-float   { animation: float 4s ease-in-out infinite; }
  .animate-glow    { animation: glow-pulse 3s ease-in-out infinite; }
  .animate-spin-slow { animation: spin-slow 20s linear infinite; }
  .animate-fade-up { animation: fade-up 0.7s var(--ease-out) both; }

  /* FOUC Prevention & Animation Bases */
  .js-enabled [data-reveal],
  .js-enabled [data-reveal-item],
  .js-enabled .section-title,
  .js-enabled .section-subtitle {
    opacity: 0;
    will-change: transform, opacity;
  }

  .js-enabled .title-line {
    display: block;
    overflow: hidden;
    padding-bottom: 0.18em;
    margin-bottom: -0.18em;
  }

  .js-enabled .title-line > span {
    display: inline-block;
    opacity: 0;
    will-change: transform, opacity;
  }

  .js-enabled .word-wrapper {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
    padding-bottom: 0.18em;
    margin-bottom: -0.18em;
  }

  .js-enabled .word-inner {
    display: inline-block;
    opacity: 0;
    will-change: transform, opacity;
  }

  /* Magnetic Buttons */
  .btn-magnetic {
    display: inline-block;
    will-change: transform;
  }

  /* Card Spotlight Glow */
  [data-tilt] {
    position: relative;
    overflow: hidden;
  }

  .card-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: radial-gradient(
      circle 180px at var(--mouse-x, 50%) var(--mouse-y, 50%),
      rgba(39, 165, 255, 0.15),
      transparent 80%
    );
  }

  [data-tilt]:hover .card-glow {
    opacity: 1;
  }

  /* Hero Big Logo & Glow Backdrop */
  .hero-logo-container {
    position: relative;
    width: fit-content;
    max-width: 320px;
    margin: 0;
    perspective: 1000px;
    overflow: visible !important;
  }

  .hero-logo-container .card-glow {
    display: none !important;
  }

  .hero-logo-large {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 15px 35px rgba(39, 165, 255, 0.25));
    will-change: transform, opacity;
  }

  .hero-logo-ring-sweep {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transform: rotate(0deg);
    transition: opacity 2s cubic-bezier(0.25, 1, 0.5, 1);
    animation: rotate-anticlockwise 2.5s linear infinite;
    will-change: transform, opacity;
  }

  /* The actual masked conic-gradient ring */
  .hero-logo-ring-sweep::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: conic-gradient(from 270deg, #ffffff 0%, rgba(255, 255, 255, 0.35) 30%, transparent 60%);
    -webkit-mask: radial-gradient(circle, transparent 96%, #000 97%);
    mask: radial-gradient(circle, transparent 96%, #000 97%);
  }

  /* Bright shining dot at the front of the trail */
  .hero-logo-ring-sweep::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px #fff, 0 0 20px rgba(255, 255, 255, 0.7), 0 0 35px rgba(255, 255, 255, 0.4);
    z-index: 3;
  }

  .hero-logo-container:hover .hero-logo-ring-sweep {
    opacity: 1;
    transition: opacity 0.4s ease;
  }

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

  .hero-logo-glow {
    position: absolute;
    inset: -40px;
    background: radial-gradient(circle, rgba(39, 165, 255, 0.25) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
    filter: blur(25px);
    pointer-events: none;
    animation: pulse-glow 4s ease-in-out infinite;
  }

  @keyframes pulse-glow {
    0%, 100% { opacity: 0.75; }
    50% { opacity: 1; }
  }

  /* Reduced motion */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      transition-duration: 0.01ms !important;
    }
  }
}

/* ─── Responsive Breakpoints ──────────────────────────────── */
@media (max-width: 1024px) {
  .container   { padding-inline: var(--space-5); }
  .section     { padding-block: var(--space-12); }
  .section-sm  { padding-block: var(--space-10); }
}

@media (max-width: 768px) {
  .container        { padding-inline: var(--space-4); }
  .section          { padding-block: var(--space-10); }
  .section-sm       { padding-block: var(--space-8); }
  .section-lg       { padding-block: var(--space-10); }
  .section-header   { margin-block-end: var(--space-5); }
  .section-title    { font-size: var(--text-3xl); }
  .section-subtitle { font-size: var(--text-base); }
}

@media (max-width: 480px) {
  .container        { padding-inline: var(--space-3); }
  .section          { padding-block: var(--space-8); }
  .section-sm       { padding-block: var(--space-6); }
  .section-header   { margin-block-end: var(--space-4); }
  .section-title    { font-size: var(--text-2xl); }
  .section-subtitle { font-size: var(--text-sm); }
}
