/**
 * Kennebex Recruiting Solutions - Custom Stylesheet & Design System
 * File: assets/css/custom.css
 * Architecture: Zero-build Pure Static HTML5 / Tailwind CDN Companion
 * Standard: WCAG 2.1 AA Compliant, Hardware-Accelerated Animations, Fluid Typography
 */

/* ==========================================================================
   1. Design Tokens (:root)
   ========================================================================== */
:root {
  /* Brand Navy Colors */
  --color-navy-dark: #161F36;
  --color-navy-slate: #1A202C;
  --color-navy-medium: #2D3748;

  /* Brand Blues */
  --color-blue-primary: #2B6CB0;
  --color-blue-interactive: #3182CE;
  --color-blue-vivid: #0693E3;
  --color-blue-pale: #8ED1FC;

  /* Accent Greens */
  --color-green-brand: #009A3C;
  --color-green-vivid: #00D084;
  --color-green-soft: #7BDCB5;
  --color-green-light: #22C55E;

  /* Neutrals */
  --color-white: #FFFFFF;
  --color-off-white: #F7FAFC;
  --color-gray-light: #EDF2F7;
  --color-gray-pale: #EAEAEA;
  --color-gray-muted: #718096;
  --color-gray-text: #707070;
  --color-slate-body: #4A5568;

  /* Functional Alert Colors */
  --color-error: #E53E3E;
  --color-error-bg: #FFF5F5;
  --color-warning: #DD6B20;
  --color-warning-bg: #FFFAF0;
  --color-success: #009A3C;
  --color-success-bg: #F0FFF4;
  --color-info: #3182CE;
  --color-info-bg: #EBF8FF;

  /* Overlays & Borders */
  --color-overlay-dark: rgba(22, 31, 54, 0.88);
  --color-overlay-dark-card: rgba(22, 31, 54, 0.95);
  --color-overlay-light: rgba(255, 255, 255, 0.92);
  --color-glass-border-light: rgba(255, 255, 255, 0.15);
  --color-glass-border-dark: rgba(22, 31, 54, 0.12);

  /* Gradients */
  --gradient-hero: linear-gradient(135deg, #161F36 0%, #1A202C 50%, #2B6CB0 100%);
  --gradient-navy-card: linear-gradient(135deg, rgba(22, 31, 54, 0.95) 0%, rgba(43, 108, 176, 0.85) 100%);
  --gradient-accent-green: linear-gradient(135deg, #009A3C 0%, #00D084 100%);
  --gradient-accent-blue: linear-gradient(135deg, #2B6CB0 0%, #3182CE 100%);
  --gradient-mesh-dark: radial-gradient(at 10% 20%, rgba(43, 108, 176, 0.18) 0px, transparent 50%), radial-gradient(at 90% 80%, rgba(0, 154, 60, 0.12) 0px, transparent 50%);

  /* Typography */
  --font-sans: 'Inter', 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  --leading-none: 1.0;
  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 1.75;

  --tracking-tighter: -0.03em;
  --tracking-tight: -0.02em;
  --tracking-normal: 0em;
  --tracking-wide: 0.05em;
  --tracking-wider: 0.1em;
  --tracking-widest: 0.15em;

  /* Fluid Typography (320px -> 1920px) */
  --font-size-hero: clamp(2.5rem, 2.2rem + 1.5vw, 4rem);
  --font-size-h1: clamp(2rem, 1.85rem + 0.75vw, 2.75rem);
  --font-size-h2: clamp(1.625rem, 1.5rem + 0.625vw, 2.25rem);
  --font-size-h3: clamp(1.25rem, 1.15rem + 0.5vw, 1.75rem);
  --font-size-h4: clamp(1.125rem, 1.075rem + 0.25vw, 1.375rem);
  --font-size-lead: clamp(1.0625rem, 1.025rem + 0.1875vw, 1.25rem);
  --font-size-body: clamp(0.9375rem, 0.9125rem + 0.125vw, 1.0625rem);
  --font-size-sm: clamp(0.8125rem, 0.8rem + 0.0625vw, 0.875rem);
  --font-size-eyebrow: clamp(0.75rem, 0.725rem + 0.125vw, 0.875rem);

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

  --section-padding-y: clamp(3rem, 2rem + 4vw, 6rem);
  --section-padding-x: clamp(1rem, 0.5rem + 2vw, 2.5rem);
  --container-max-width: 1280px;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(22, 31, 54, 0.05);
  --shadow-sm: 0 2px 4px 0 rgba(22, 31, 54, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(22, 31, 54, 0.1), 0 2px 4px -1px rgba(22, 31, 54, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(22, 31, 54, 0.1), 0 4px 6px -2px rgba(22, 31, 54, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(22, 31, 54, 0.12), 0 10px 10px -5px rgba(22, 31, 54, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(22, 31, 54, 0.25);
  --shadow-glow-blue: 0 0 20px rgba(43, 108, 176, 0.35);
  --shadow-glow-green: 0 0 20px rgba(0, 154, 60, 0.35);
  --shadow-inner: inset 0 2px 4px 0 rgba(22, 31, 54, 0.06);

  /* Radii */
  --radius-xs: 0.125rem;
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout Header Offset */
  --header-height: 80px;
}

/* ==========================================================================
   2. Base & Scrollbar Styles
   ========================================================================== */
html {
  scroll-behavior: smooth;
  font-family: var(--font-sans);
  color: var(--color-slate-body);
  background-color: var(--color-off-white);
  scrollbar-width: thin;
  scrollbar-color: var(--color-navy-medium) var(--color-off-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

::-webkit-scrollbar-track {
  background: var(--color-off-white);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
  background: #CBD5E0;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-off-white);
  transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-muted);
}

::-webkit-scrollbar-thumb:active {
  background: var(--color-blue-primary);
}

/* ==========================================================================
   3. WCAG AA Focus Ring Accessibility
   ========================================================================== */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 2px solid var(--color-green-brand);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(0, 154, 60, 0.25);
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   4. Zero-CLS Dual-Market Content Display Gating Rules
   ========================================================================== */
html[data-market="de"] [data-market="ca"]:not([data-market="all"]),
html[data-market="ca"] [data-market="de"]:not([data-market="all"]),
html[data-active-market="de"] [data-market="ca"]:not([data-market="all"]),
html[data-active-market="ca"] [data-market="de"]:not([data-market="all"]),
body[data-market="ca"] [data-market-target="de"],
body[data-market="de"] [data-market-target="ca"] {
  display: none !important;
}

/* ==========================================================================
   5. Keyframe Animations & Micro-Interactions
   ========================================================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseSubtle {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.02);
  }
}

.animate-fade-in { animation: fadeIn var(--transition-normal) ease-out forwards; }
.animate-fade-in-up { animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-pulse-subtle { animation: pulseSubtle 3s ease-in-out infinite; }

/* Accordion CSS Grid 60FPS */
.accordion-panel,
.accordion-content-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  opacity: 0;
}

.accordion-panel.is-open,
.accordion-content-wrapper.open,
details[open] > .accordion-content-wrapper {
  grid-template-rows: 1fr;
  opacity: 1;
}

.accordion-inner {
  overflow: hidden;
}

/* Hallmark Heading Accent Line */
.heading-accent-green {
  position: relative;
  display: inline-block;
  padding-bottom: 0.75rem;
}

.heading-accent-green::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 3px;
  background: var(--color-green-brand);
  border-radius: var(--radius-full);
}

/* Dual-Market Switcher Styles */
.market-switcher-container {
  display: inline-flex;
  align-items: center;
  background: rgba(22, 31, 54, 0.6);
  border: 1px solid var(--color-glass-border-light);
  border-radius: var(--radius-full);
  padding: 3px;
  backdrop-filter: blur(8px);
}

/* Glassmorphism Panels */
.glass-card-dark {
  background: var(--color-overlay-dark-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-glass-border-light);
  border-radius: var(--radius-xl);
}

.glass-card-light {
  background: var(--color-overlay-light);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-gray-light);
  border-radius: var(--radius-xl);
}

/* Trust Badge Pill */
.trust-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-eyebrow);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  background: rgba(0, 154, 60, 0.12);
  color: var(--color-green-brand);
  border: 1px solid rgba(0, 154, 60, 0.25);
}

/* Screen Reader Only Utility */
.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;
}

.focus\:not-sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Reduced Motion Preferences */
@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;
  }
}

/* Print Utilities */
@media print {
  header,
  footer,
  .market-switcher-desktop,
  .market-switcher-mobile-quick,
  #mobile-menu-drawer,
  #funnel-modal {
    display: none !important;
  }
  
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
  }
}
