/* ============================================
   BASE.CSS — Contablue Design System
   Contablue Enterprise — Bold Orange Industrial
   ============================================ */

/* --- Contablue Design Tokens --- */
:root {

  /* ── Core Colors ── */
  --bg: #0C0A09;
  --bg-alt: #1A1614;
  --surface: #1C1917;
  --surface-hover: #292524;
  --text: #FAFAF9;
  --text-secondary: #D6D3D1;
  --text-muted: #8C857F;
  --border: rgba(240, 100, 39, 0.12);
  --border-hover: rgba(240, 100, 39, 0.25);

  /* ── Accent — Contablue Orange ── */
  --accent: #F06427;
  --accent-hover: #F97316;
  --accent-warm: #E8913A;
  --accent-deep: #DC5520;
  --accent-light: rgba(240, 100, 39, 0.12);
  /* Backward compat — remove when all refs are updated */
  --accent-cyan: #E8913A;

  /* ── Semantic State Colors ── */
  --success: #22C55E;
  --success-light: rgba(34, 197, 94, 0.1);
  --success-border: rgba(34, 197, 94, 0.3);
  --error: #EF4444;
  --error-light: rgba(239, 68, 68, 0.1);
  --error-border: rgba(239, 68, 68, 0.3);
  --warning: #FBBF24;
  --warning-light: rgba(251, 191, 36, 0.1);
  --info: #3B82F6;
  --info-light: rgba(59, 130, 246, 0.1);

  /* ── CTA ── */
  --cta-bg: #C2410C;
  --cta-text: #FFFFFF;

  /* ── Glass (kept for backward compat, prefer solid surfaces) ── */
  --glass-bg: var(--surface);
  --glass-border: var(--border);

  /* ── Nav ── */
  --nav-bg: var(--bg);
  --nav-bg-scrolled: var(--bg);
  --nav-border: var(--border);

  /* ── Sections ── */
  --stats-bg: #1A1614;
  --stats-text: #FAFAF9;
  --stats-text-secondary: #A8A29E;
  --cta-section-bg: #1C1917;
  --cta-section-text: #FAFAF9;
  --footer-bg: #0C0A09;
  --footer-text: #A8A29E;
  --footer-border: rgba(240, 100, 39, 0.08);

  /* ── Shadows (neutral, no accent tint) ── */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.16);
  --shadow-mega: 0 8px 30px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(0, 0, 0, 0.1);
  --shadow-accent: 0 0 12px rgba(240, 100, 39, 0.2);
  --shadow-accent-lg: 0 4px 24px rgba(240, 100, 39, 0.3);
  /* Backward compat aliases */
  --card-shadow: var(--shadow-md);
  --card-shadow-hover: var(--shadow-lg);
  --card-border: 1px solid var(--border);

  /* ── Border Radius ── */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* ── Spacing Scale (4px base) ── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 64px;
  --space-11: 80px;
  --space-12: 100px;
  --space-13: 120px;
  --space-14: 140px;

  /* ── Typography Scale ── */
  --text-2xs: 0.6875rem;   /* 11px */
  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.8125rem;    /* 13px */
  --text-base: 0.875rem;   /* 14px */
  --text-md: 0.9375rem;    /* 15px */
  --text-lg: 1rem;         /* 16px */
  --text-xl: 1.0625rem;    /* 17px */
  --text-2xl: 1.125rem;    /* 18px */
  --text-3xl: 1.25rem;     /* 20px */
  --text-4xl: 1.375rem;    /* 22px */
  --text-5xl: 1.5rem;      /* 24px */
  --text-6xl: 1.875rem;    /* 30px */
  --text-7xl: 2.25rem;     /* 36px */
  --text-8xl: 3rem;        /* 48px */
  --text-9xl: 3.75rem;     /* 60px */

  /* ── Letter Spacing ── */
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.05em;

  /* ── Line Heights ── */
  --leading-none: 1;
  --leading-tight: 1.1;
  --leading-snug: 1.4;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;
  --leading-loose: 1.7;

  /* ── Font Stacks ── */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* ── Transitions ── */
  --duration-fast: 0.15s;
  --duration-normal: 0.25s;
  --duration-slow: 0.35s;
  --ease-default: ease;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);

  /* ── Layout ── */
  --container-max: 1280px;
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-narrow: 560px;
  --container-content: 720px;
  --container-prose: 800px;

  /* ── Utility Bar ── */
  --utility-bar-height: 36px;

  /* ── Z-Index Scale ── */
  --z-base: 0;
  --z-above: 2;
  --z-hero: 10;
  --z-dropdown: 100;
  --z-mobile-menu: 999;
  --z-navbar: 1000;
  --z-utility-bar: 1001;
  --z-announcement: 1002;
  --z-skip-link: 10000;

  /* ── Divisions ── */
  --division-software: #F97316;
  --division-safety: #FBBF24;
  --division-automate: #F06427;
  --division-footwear: #A78BFA;
  --division-software-light: rgba(249, 115, 22, 0.1);
  --division-safety-light: rgba(251, 191, 36, 0.1);
  --division-automate-light: rgba(220, 85, 32, 0.1);
  --division-footwear-light: rgba(167, 139, 250, 0.1);

  /* ── Icon Colors (industry cards) ── */
  --icon-orange: #F97316;
  --icon-yellow: #FBBF24;
  --icon-red: #F87171;
  --icon-cyan: #22D3EE;
  --icon-purple: #A78BFA;
  --icon-green: #34D399;
  --icon-pink: #F472B6;
}

/* --- LIGHT MODE --- */
html[data-theme="light"] {
  --bg: #FAFAF9;
  --bg-alt: #F5F5F4;
  --surface: #FFFFFF;
  --surface-hover: #FAFAF9;
  --text: #1C1917;
  --text-secondary: #57534E;
  --text-muted: #6B6560;
  --border: rgba(240, 100, 39, 0.1);
  --border-hover: rgba(240, 100, 39, 0.25);

  --accent: #B93B0A;
  --accent-hover: #DC5520;
  --accent-warm: #9A3209;
  --accent-deep: #9A3209;
  --accent-cyan: #9A3209; /* backward compat */
  --accent-light: rgba(220, 85, 32, 0.08);

  /* Semantic states (darker for contrast on light bg) */
  --success: #16A34A;
  --success-light: rgba(22, 163, 74, 0.08);
  --success-border: rgba(22, 163, 74, 0.25);
  --error: #DC2626;
  --error-light: rgba(220, 38, 38, 0.06);
  --error-border: rgba(220, 38, 38, 0.25);
  --warning: #D97706;
  --warning-light: rgba(217, 119, 6, 0.08);
  --info: #2563EB;
  --info-light: rgba(37, 99, 235, 0.08);

  --cta-bg: #9A3209;
  --cta-text: #FFFFFF;

  --glass-bg: var(--surface);
  --glass-border: var(--border);

  --nav-bg: var(--bg);
  --nav-bg-scrolled: var(--bg);
  --nav-border: rgba(0, 0, 0, 0.06);

  --stats-bg: #F5F5F4;
  --stats-text: #1C1917;
  --stats-text-secondary: #6B6560;
  --cta-section-bg: #0F172A;
  --cta-section-text: #F9FAFB;
  --footer-bg: #FAFAF9;
  --footer-text: #6B6560;
  --footer-border: #E7E5E4;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.06);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.08);
  --shadow-mega: 0 8px 30px rgba(0, 0, 0, 0.08), 0 1px 0 rgba(0, 0, 0, 0.04);

  --division-software: #F06427;
  --division-safety: #D97706;
  --division-automate: #E8913A;
  --division-footwear: #7C3AED;
  --division-software-light: rgba(240, 100, 39, 0.08);
  --division-safety-light: rgba(217, 119, 6, 0.08);
  --division-automate-light: rgba(232, 145, 58, 0.08);
  --division-footwear-light: rgba(124, 58, 237, 0.08);

  --shadow-accent: 0 0 12px rgba(220, 85, 32, 0.15);
  --shadow-accent-lg: 0 4px 24px rgba(220, 85, 32, 0.2);

  --icon-orange: #EA580C;
  --icon-yellow: #D97706;
  --icon-red: #DC2626;
  --icon-cyan: #0891B2;
  --icon-purple: #7C3AED;
  --icon-green: #059669;
  --icon-pink: #DB2777;
}

/* Light mode specific overrides */
html[data-theme="light"] .hero-typing {
  color: var(--accent);
}

html[data-theme="light"] .stat-number {
  color: var(--text);
}

html[data-theme="light"] .enterprise-form input {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

html[data-theme="light"] .cta-section {
  background: var(--cta-section-bg);
}

html[data-theme="light"] .cta-text h2 {
  color: var(--cta-section-text);
}

html[data-theme="light"] .cta-text p {
  color: #94A3B8;
}

html[data-theme="light"] .enterprise-form input {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
  color: #F9FAFB;
}

html[data-theme="light"] .enterprise-form input::placeholder {
  color: rgba(255,255,255,0.4);
}

html[data-theme="light"] .form-disclaimer {
  color: rgba(255,255,255,0.4) !important;
}

/* Theme transition — applied only to key elements, not universally */

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: var(--leading-relaxed);
  color: var(--text);
  background-color: var(--bg);
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; transition: color var(--duration-fast) var(--ease-default); }

/* Ensure inline content links are distinguishable (WCAG 1.4.1) */
.entry-content a,
.section-content a,
.prose a {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 2px;
}

.entry-content a:hover,
.section-content a:hover,
.prose a:hover {
  text-decoration-color: var(--accent-hover);
}

ul, ol { list-style: none; }
button, input { font-family: inherit; font-size: inherit; border: none; outline: none; background: none; color: inherit; }
button { cursor: pointer; }

/* --- Skip Link --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: var(--z-skip-link);
  padding: 12px 24px;
  background: var(--accent);
  color: var(--cta-text);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-weight: 600;
  transition: top 0.2s;
}

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

/* --- MASSIVE Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 800;
  line-height: var(--leading-tight);
  color: var(--text);
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 900;
  letter-spacing: -0.045em;
}

h2 {
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  letter-spacing: -0.04em;
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.75rem);
}

h4 { font-size: var(--text-2xl); }

h5 { font-size: var(--text-2xl); font-weight: 700; }

h6 { font-size: var(--text-lg); font-weight: 700; }

p {
  color: var(--text-secondary);
}

.mono { font-family: var(--font-mono); }

/* --- Gradient Text Utility (hero H1 signature only) --- */
.gradient-text {
  background: linear-gradient(135deg, #F06427, #E8913A);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-sm { max-width: var(--container-sm); }
.container-md { max-width: var(--container-md); }
.container-lg { max-width: var(--container-lg); }

@media (min-width: 768px) { .container { padding: 0 var(--space-7); } }
@media (min-width: 1024px) { .container { padding: 0 var(--space-9); } }

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

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

/* --- Section Spacing --- */
.section-padding { padding: var(--space-10) 0; }
@media (min-width: 768px) { .section-padding { padding: var(--space-11) 0; } }
@media (min-width: 1024px) { .section-padding { padding: var(--space-12) 0; } }

.section-compact { padding: var(--space-8) 0; }
@media (min-width: 768px) { .section-compact { padding: var(--space-9) 0; } }

.section-breathe { padding: var(--space-11) 0; }
@media (min-width: 768px) { .section-breathe { padding: var(--space-13) 0; } }
@media (min-width: 1024px) { .section-breathe { padding: var(--space-14) 0; } }

/* --- Section Header --- */
.section-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto var(--space-9);
}

.section-header .badge { margin-bottom: var(--space-3); }

.section-header p {
  margin-top: var(--space-3);
  font-size: var(--text-xl);
  line-height: var(--leading-loose);
}

@media (min-width: 768px) { .section-header { margin-bottom: var(--space-10); } }

/* --- Separator --- */
.glow-separator {
  height: 1px;
  background: var(--border);
  margin: 0;
}

/* --- Focus Visible --- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Selection --- */
::selection {
  background: var(--accent);
  color: var(--cta-text);
}

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