/* ============================================
   DESIGN SYSTEM - CSS Variables & Tokens
   clearMetric LTD Website
   ============================================ */

:root {
  /* ===== COLOR SYSTEM ===== */
  
  /* Primary Colors */
  --primary: #1a1f36;              /* Main brand color (dark navy) */
  --primary-dark: #0f1729;         /* Hover/active state */
  --primary-light: #2d3548;        /* Light variant */
  --primary-foreground: #ffffff;   /* Text on primary */
  
  /* Secondary Colors */
  --secondary: #4a5568;            /* Secondary brand (gray-blue) */
  --secondary-dark: #2d3748;       /* Darker secondary */
  --secondary-light: #718096;      /* Lighter secondary */
  
  /* Accent Colors */
  --accent: #8f6d35;               /* Accessible gold accent */
  --accent-dark: #7b5a28;          /* Darker accent */
  --accent-light: #c9a66e;         /* Lighter accent */
  --accent-foreground: #ffffff;    /* Text on accent */
  
  /* Semantic Colors */
  --success: #10b981;              /* Green (success) */
  --success-light: #6ee7b7;        /* Light green */
  --success-dark: #059669;         /* Dark green */
  
  --warning: #f59e0b;              /* Amber (warning) */
  --warning-light: #fcd34d;        /* Light amber */
  --warning-dark: #d97706;         /* Dark amber */
  
  --danger: #ef4444;               /* Red (error/danger) */
  --danger-light: #fca5a5;         /* Light red */
  --danger-dark: #dc2626;          /* Dark red */
  
  --info: #3b82f6;                 /* Blue (info) */
  --info-light: #93c5fd;           /* Light blue */
  --info-dark: #1d4ed8;            /* Dark blue */
  
  /* Neutral Colors */
  --neutral-50: #f9fafb;           /* Nearly white background */
  --neutral-100: #f3f4f6;          /* Very light gray */
  --neutral-200: #e5e7eb;          /* Light gray (borders) */
  --neutral-300: #d1d5db;          /* Gray */
  --neutral-400: #9ca3af;          /* Medium gray */
  --neutral-500: #6b7280;          /* Dark gray (secondary text) */
  --neutral-600: #4b5563;          /* Darker gray */
  --neutral-700: #374151;          /* Very dark gray */
  --neutral-800: #1f2937;          /* Almost black */
  --neutral-900: #111827;          /* Black */
  
  /* Alias Colors (for backward compatibility) */
  --dark: #1a1f36;
  --light: #f7f7f8;
  --background: #ffffff;
  --card: #ffffff;
  --muted: #f7f7f8;
  --muted-foreground: #6b7280;
  --border: #e5e7eb;
  --input-background: #f3f3f5;
  --foreground: #1a1f36;
  --destructive: #ef4444;
  
  /* ===== TYPOGRAPHY ===== */
  
  /* Font Families */
  --font-heading: 'Libre Baskerville', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Menlo', 'Monaco', 'Courier New', monospace;
  
  /* Font Sizes */
  --text-xs: clamp(0.6875rem, 0.65rem + 0.15vw, 0.75rem);   /* 11px -> 12px */
  --text-sm: clamp(0.8125rem, 0.75rem + 0.25vw, 0.875rem);  /* 13px -> 14px */
  --text-base: clamp(0.9375rem, 0.875rem + 0.25vw, 1rem);    /* 15px -> 16px */
  --text-lg: clamp(1.0625rem, 1rem + 0.25vw, 1.125rem);      /* 17px -> 18px */
  --text-xl: clamp(1.1875rem, 1.0625rem + 0.5vw, 1.25rem);   /* 19px -> 20px */
  --text-2xl: clamp(1.375rem, 1.125rem + 1vw, 1.5rem);       /* 22px -> 24px */
  --text-3xl: clamp(1.75rem, 1.375rem + 1.5vw, 1.875rem);    /* 28px -> 30px */
  --text-4xl: clamp(2rem, 1.5rem + 2vw, 2.25rem);            /* 32px -> 36px */
  --text-5xl: clamp(2.5rem, 1.75rem + 3vw, 3rem);            /* 40px -> 48px */
  --text-6xl: clamp(3rem, 2rem + 4vw, 3.75rem);              /* 48px -> 60px */
  --text-7xl: clamp(3.5rem, 2.5rem + 4vw, 4.5rem);           /* 56px -> 72px */
  
  /* Font Weights */
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;
  
  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;
  
  /* Letter Spacing */
  --tracking-tighter: -0.05em;
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;
  
  /* ===== SPACING ===== */
  
  /* 4-Point Spacing Scale */
  --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 */
  
  /* ===== SIZE SCALE ===== */
  
  --size-1: 0.25rem;               /* 4px */
  --size-2: 0.5rem;                /* 8px */
  --size-4: 1rem;                  /* 16px */
  --size-6: 1.5rem;                /* 24px */
  --size-8: 2rem;                  /* 32px */
  --size-12: 3rem;                 /* 48px */
  --size-16: 4rem;                 /* 64px */
  --size-20: 5rem;                 /* 80px */
  --size-24: 6rem;                 /* 96px */
  --size-32: 8rem;                 /* 128px */
  --size-full: 100%;
  --size-screen: 100vw;
  
  /* ===== BORDER ===== */
  
  /* Border Radius */
  --radius-none: 0;
  --radius-xs: 0.125rem;           /* 2px */
  --radius-sm: 0.25rem;            /* 4px */
  --radius-base: 0.375rem;         /* 6px */
  --radius-md: 0.5rem;             /* 8px */
  --radius-lg: 0.75rem;            /* 12px */
  --radius-xl: 1rem;               /* 16px */
  --radius-2xl: 1.5rem;            /* 24px */
  --radius-full: 9999px;           /* Pill-shaped */
  
  /* Border Width */
  --border-width-0: 0;
  --border-width-1: 1px;
  --border-width-2: 2px;
  --border-width-4: 4px;
  --border-width-8: 8px;
  
  /* ===== SHADOWS ===== */
  
  /* Box Shadows */
  --shadow-none: none;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Elevation Shadows */
  --shadow-elevation-1: 0 1px 3px rgba(26, 31, 54, 0.06);
  --shadow-elevation-2: 0 4px 16px rgba(26, 31, 54, 0.12);
  --shadow-elevation-3: 0 12px 32px rgba(26, 31, 54, 0.18);
  --shadow-elevation-4: 0 20px 48px rgba(26, 31, 54, 0.24);
  
  /* ===== TRANSITIONS ===== */
  
  /* Animation Durations */
  --duration-75: 75ms;
  --duration-100: 100ms;
  --duration-150: 150ms;
  --duration-200: 200ms;
  --duration-300: 300ms;
  --duration-500: 500ms;
  --duration-700: 700ms;
  --duration-1000: 1000ms;

  /* Touch targets */
  --touch-target-min: 44px;
  
  /* Easing Functions */
  --ease-linear: linear;
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  
  /* ===== BREAKPOINTS ===== */
  
  /* Note: Use in media queries as @media (min-width: 768px) */
  --breakpoint-sm: 640px;          /* Small devices */
  --breakpoint-md: 768px;          /* Medium devices (tablet) */
  --breakpoint-lg: 1024px;         /* Large devices (desktop) */
  --breakpoint-xl: 1280px;         /* Extra large devices */
  --breakpoint-2xl: 1536px;        /* XXL devices */
  
  /* ===== Z-INDEX SCALE ===== */
  
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-notification: 1080;
  
  /* ===== OPACITY ===== */
  
  --opacity-0: 0;
  --opacity-5: 0.05;
  --opacity-10: 0.1;
  --opacity-20: 0.2;
  --opacity-25: 0.25;
  --opacity-30: 0.3;
  --opacity-40: 0.4;
  --opacity-50: 0.5;
  --opacity-60: 0.6;
  --opacity-70: 0.7;
  --opacity-75: 0.75;
  --opacity-80: 0.8;
  --opacity-90: 0.9;
  --opacity-95: 0.95;
  --opacity-100: 1;
}

/* ===== LIGHT MODE ===== */
@media (prefers-color-scheme: light) {
  :root {
    /* Ensure light mode colors are used */
    --background: #ffffff;
    --foreground: #1a1f36;
  }
}

/* ===== DARK MODE (Future Support) ===== */
@media (prefers-color-scheme: dark) {
  :root {
    /* Dark mode can be implemented here */
    /* For now, using light mode as default */
  }
}

/* ===== ACCESSIBILITY: REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-75: 0ms;
    --duration-100: 0ms;
    --duration-150: 0ms;
    --duration-200: 0ms;
    --duration-300: 0ms;
    --duration-500: 0ms;
    --duration-700: 0ms;
    --duration-1000: 0ms;
  }
}

/* ════════════════════════════════════════════════════════════════════ */
/* GLOBAL BASE STYLES                                                    */
/* ════════════════════════════════════════════════════════════════════ */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--foreground);
  background: var(--background);
}

/* ── Typography Scale ── */
h1 {
  font-family: var(--font-heading);
  font-size: clamp(48px, 5vw, 60px);
  font-weight: 700;
  line-height: 1.3;
  color: var(--foreground);
}

h2 {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--foreground);
}

h3 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--foreground);
}

h4 {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--foreground);
}

p {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted-foreground);
}

/* ── Eyebrow / Badge Label ── */
.eyebrow {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
}

/* ── Container ── */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 32px;
}

@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
}

/* ── Section Wrapper ── */
.section {
  padding: var(--section-padding) 0;
}

.section--muted {
  background: var(--muted);
}

.section--dark {
  background: var(--primary);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 16px 32px;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-foreground);
}

.btn--primary:hover {
  background: var(--accent-dark);
}

.btn--secondary {
  background: var(--primary-foreground);
  color: var(--primary);
}

.btn--secondary:hover {
  background: rgba(255, 255, 255, 0.9);
}

.btn--outline {
  background: transparent;
  color: var(--primary-foreground);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn--outline:hover {
  border-color: rgba(255, 255, 255, 0.5);
}

.btn--nav {
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 10px 24px;
  font-size: 14px;
}

.btn--nav:hover {
  background: var(--secondary);
}

/* ── Accessibility: Skip Link ── */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: var(--accent-foreground);
  padding: 8px 16px;
  z-index: 999;
  transition: top 200ms;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
}

/* ── Focus rings on all interactive elements ── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Links ── */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 200ms ease;
}

a:hover {
  color: var(--accent-dark);
}

/* ── Lists ── */
ul,
ol {
  margin-left: 20px;
}

li {
  margin-bottom: 8px;
}

/* ── Section Header Pattern ── */
.section-header {
  margin-bottom: 48px;
}

.section-header--centered {
  text-align: center;
}

.section-header .eyebrow {
  margin-bottom: 12px;
}

.section-header h2 {
  margin-bottom: 16px;
}

.section-header__sub {
  font-size: 18px;
  color: var(--muted-foreground);
  line-height: 1.6;
  max-width: 32rem;
}

.section-header--centered .section-header__sub {
  margin: 0 auto;
}

/* ── Images ── */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Forms Base ── */
input,
textarea,
select {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--foreground);
}

input,
textarea {
  background: var(--input-background);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 12px 16px;
  width: 100%;
  transition: border-color 200ms ease;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  outline: none;
}

/* ════════════════════════════════════════════════════════════════════ */
/* UTILITY CLASSES                                                       */
/* ════════════════════════════════════════════════════════════════════ */

.text-center {
  text-align: center;
}

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

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.grid { display: grid; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.hidden { display: none; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }

.transition { transition: all 200ms ease; }

.rounded { border-radius: var(--radius-xs); }
.rounded-lg { border-radius: var(--radius-md); }

.border { border: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-l { border-left: 1px solid var(--border); }
.border-r { border-right: 1px solid var(--border); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-base); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
