/* ==========================================================================
   NexTool Revolution — Base CSS
   Design System Foundation: Variables, Reset, Typography, Spacing

   Philosophy: Every value is intentional. No magic numbers.
   Dark-first. Mobile-first. Performance-first.
   ========================================================================== */

/* --------------------------------------------------------------------------
   CUSTOM PROPERTIES — The DNA of the Design System
   -------------------------------------------------------------------------- */

:root {
  /* === Color System === */

  /* Background Hierarchy — Near-black, not pure black (easier on eyes, feels premium) */
  --bg-void: #050505;                        /* Deepest — hero backgrounds */
  --bg-primary: #0A0A0A;                     /* Main background */
  --bg-secondary: #111111;                   /* Cards, elevated surfaces */
  --bg-tertiary: #1A1A1A;                    /* Inputs, hover states */
  --bg-quaternary: #222222;                  /* Active states */
  --bg-glass: rgba(255, 255, 255, 0.03);    /* Glassmorphism overlays */
  --bg-glass-hover: rgba(255, 255, 255, 0.06);

  /* Text Hierarchy — Opacity-based, not color-based (stays consistent) */
  --text-primary: rgba(255, 255, 255, 0.95);     /* Headlines, primary content */
  --text-secondary: rgba(255, 255, 255, 0.60);   /* Body text, descriptions */
  --text-tertiary: rgba(255, 255, 255, 0.40);    /* Labels, hints, captions */
  --text-muted: rgba(255, 255, 255, 0.20);       /* Disabled, decorative */
  --text-ghost: rgba(255, 255, 255, 0.08);       /* Watermarks, ghost text */

  /* Accent — Distinct, ownable, not another boring blue */
  --accent: #635BFF;                              /* Primary accent — Stripe-inspired indigo */
  --accent-light: #7B74FF;                        /* Lighter for hover */
  --accent-dark: #4B44CC;                         /* Darker for active */
  --accent-glow: rgba(99, 91, 255, 0.15);        /* Glow effects */
  --accent-glow-strong: rgba(99, 91, 255, 0.30); /* Stronger glow */
  --accent-surface: rgba(99, 91, 255, 0.08);     /* Surface tint */
  --accent-gradient: linear-gradient(135deg, #635BFF 0%, #00D4FF 100%);
  --accent-gradient-hover: linear-gradient(135deg, #7B74FF 0%, #33DDFF 100%);

  /* Secondary Accent — Cyan for contrast and freshness */
  --cyan: #00D4FF;
  --cyan-glow: rgba(0, 212, 255, 0.15);

  /* Semantic Colors */
  --success: #00C853;
  --success-surface: rgba(0, 200, 83, 0.08);
  --warning: #FFB300;
  --warning-surface: rgba(255, 179, 0, 0.08);
  --error: #FF3D00;
  --error-surface: rgba(255, 61, 0, 0.08);

  /* Borders — Invisible until needed */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.10);
  --border-active: rgba(255, 255, 255, 0.18);
  --border-accent: rgba(99, 91, 255, 0.40);

  /* === Typography === */

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Type Scale — Fluid, responsive, no breakpoint jumps */
  --text-xs: clamp(0.6875rem, 0.65rem + 0.15vw, 0.8125rem);    /* 11-13px */
  --text-sm: clamp(0.8125rem, 0.77rem + 0.18vw, 0.9375rem);    /* 13-15px */
  --text-base: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);          /* 16-18px */
  --text-lg: clamp(1.125rem, 1.05rem + 0.3vw, 1.3125rem);      /* 18-21px */
  --text-xl: clamp(1.25rem, 1.1rem + 0.6vw, 1.75rem);          /* 20-28px */
  --text-2xl: clamp(1.5rem, 1.2rem + 1.2vw, 2.5rem);           /* 24-40px */
  --text-3xl: clamp(2rem, 1.5rem + 2vw, 3.5rem);               /* 32-56px */
  --text-4xl: clamp(2.5rem, 1.8rem + 3vw, 4.5rem);             /* 40-72px */
  --text-hero: clamp(3rem, 2rem + 4.5vw, 6rem);                 /* 48-96px */

  /* Font Weights */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.05;
  --leading-snug: 1.15;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  /* Letter Spacing */
  --tracking-tighter: -0.04em;
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  --tracking-caps: 0.12em;

  /* === Spacing — 4px base unit === */
  --space-1: 0.25rem;    /* 4px */
  --space-2: 0.5rem;     /* 8px */
  --space-3: 0.75rem;    /* 12px */
  --space-4: 1rem;       /* 16px */
  --space-5: 1.25rem;    /* 20px */
  --space-6: 1.5rem;     /* 24px */
  --space-8: 2rem;       /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */
  --space-16: 4rem;      /* 64px */
  --space-20: 5rem;      /* 80px */
  --space-24: 6rem;      /* 96px */
  --space-32: 8rem;      /* 128px */
  --space-40: 10rem;     /* 160px */
  --space-section: clamp(5rem, 4rem + 4vw, 10rem);  /* Section gaps — fluid */

  /* === Layout === */
  --max-width: 1200px;
  --max-width-narrow: 800px;
  --max-width-wide: 1400px;
  --content-padding: clamp(1.25rem, 1rem + 2vw, 3rem);  /* Side padding */

  /* === Borders & Radius === */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* === Shadows — Layered for depth === */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px var(--accent-glow);
  --shadow-glow-strong: 0 0 60px var(--accent-glow-strong);

  /* === Motion — Natural, not mechanical === */
  --duration-instant: 100ms;
  --duration-fast: 200ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --duration-slower: 800ms;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);        /* Snappy deceleration */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);    /* Smooth symmetric */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* Slight overshoot */
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.27, 1.55);

  /* === Z-Index Scale === */
  --z-base: 0;
  --z-above: 10;
  --z-nav: 100;
  --z-overlay: 200;
  --z-modal: 300;
  --z-toast: 400;
  --z-max: 9999;
}


/* --------------------------------------------------------------------------
   CSS RESET — Modern, minimal, opinionated
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  hanging-punctuation: first last;
  tab-size: 4;
}

/* Lenis smooth scroll — overrides native smooth-scroll when active */
html.lenis, html.lenis body {
  height: auto;
}
html.lenis {
  scroll-behavior: auto; /* Lenis handles scrolling */
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--text-secondary);
  background-color: var(--bg-primary);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Remove default styles */
h1, h2, h3, h4, h5, h6 {
  font-size: inherit;
  font-weight: inherit;
}

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

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

input, button, textarea, select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

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

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

/* Remove all animations for people who prefer not to see them */
@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;
  }
}


/* --------------------------------------------------------------------------
   FONT FACE — Inter Variable (self-hosted)
   -------------------------------------------------------------------------- */

@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}


/* --------------------------------------------------------------------------
   TYPOGRAPHY — The backbone of the design
   -------------------------------------------------------------------------- */

/* Hero headline — The biggest, boldest. One per page. */
.text-hero {
  font-size: var(--text-hero);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tighter);
  color: var(--text-primary);
}

/* Section headlines — One per section. Clear hierarchy. */
.text-display {
  font-size: var(--text-4xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

.text-title {
  font-size: var(--text-3xl);
  font-weight: var(--weight-medium);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

.text-heading {
  font-size: var(--text-2xl);
  font-weight: var(--weight-medium);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

.text-subheading {
  font-size: var(--text-xl);
  font-weight: var(--weight-medium);
  line-height: var(--leading-snug);
  color: var(--text-primary);
}

/* Body text */
.text-body-lg {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}

.text-body {
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-secondary);
}

.text-body-sm {
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text-tertiary);
}

/* Labels, tags, overlines */
.text-overline {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--accent);
}

.text-caption {
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--text-tertiary);
}

/* Monospace — for code/prompt previews */
.text-mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

/* Gradient text — for impact moments only */
.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}


/* --------------------------------------------------------------------------
   LAYOUT UTILITIES
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--content-padding);
}

.container--narrow {
  max-width: var(--max-width-narrow);
}

.container--wide {
  max-width: var(--max-width-wide);
}

/* Section spacing */
.section {
  padding-block: var(--space-section);
  position: relative;
}

/* Visually hidden but accessible to screen readers */
.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;
}


/* --------------------------------------------------------------------------
   SELECTION STYLES
   -------------------------------------------------------------------------- */

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


/* --------------------------------------------------------------------------
   SCROLLBAR — Minimal, premium feel
   -------------------------------------------------------------------------- */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.20);
}

/* Firefox */
@supports (scrollbar-width: thin) {
  * {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
  }
}


/* --------------------------------------------------------------------------
   FOCUS STYLES — Accessible but beautiful
   -------------------------------------------------------------------------- */

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

/* Only show focus ring for keyboard navigation */
:focus:not(:focus-visible) {
  outline: none;
}
