/**
 * Nwestco Base Styles
 * Core design tokens and typography
 * These will be refined by UI-001 design system task
 */

:root {
  /* Colors - Placeholder values based on current site */
  --color-primary: #003366;
  --color-secondary: #0066CC;
  --color-accent: #FF6600;
  --color-text: #333333;
  --color-text-light: #666666;
  --color-background: #FFFFFF;
  --color-background-alt: #F5F5F5;
  --color-border: #DDDDDD;

  /* Typography */
  --font-primary: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-secondary: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Font sizes - Fluid typography */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.625vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.25rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.5rem + 2.5vw, 3.5rem);

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-2xl: 4rem;

  /* Container widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;

  /* Border radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;
}

/* Base typography */
body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-background);
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-secondary);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-primary);
  margin-bottom: var(--spacing-sm);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-base); }

p {
  margin-bottom: var(--spacing-sm);
}

a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  opacity: 0.85;
}

a:focus {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

/* Container utilities */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: var(--spacing-md);
}

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

/* Skip navigation for accessibility */
.skip-nav {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  text-decoration: none;
  z-index: 100;
}

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

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

/* Utility classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }


/* ============================================================
   ACCESSIBILITY ENHANCEMENTS - WCAG 2.1 AA Compliance
   ============================================================ */

/* Focus visible for keyboard navigation (modern browsers) */
:focus-visible {
  outline: 3px solid var(--color-secondary);
  outline-offset: 2px;
}

/* Remove outline for mouse users, keep for keyboard */
:focus:not(:focus-visible) {
  outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --color-primary: #000066;
    --color-secondary: #0000CC;
    --color-text: #000000;
    --color-border: #000000;
  }

  a:focus,
  button:focus,
  input:focus,
  select:focus,
  textarea:focus {
    outline-width: 3px;
    outline-style: solid;
  }
}

/* Reduced motion preference */
@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;
  }
}

/* Ensure minimum touch target size (44x44px for WCAG 2.1 AAA) */
button,
[role="button"],
a.btn,
.btn {
  min-height: 44px;
  min-width: 44px;
}

/* Improved link accessibility - underline on hover/focus */
a:not(.btn):hover,
a:not(.btn):focus {
  text-decoration: underline;
}

/* Focus trap indicator for modal/dialog elements */
[aria-modal="true"]:focus {
  outline: 3px solid var(--color-secondary);
}

/* Hidden but accessible - alternative to sr-only */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Make sure disabled elements are clearly indicated */
[disabled],
[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Ensure proper color contrast for placeholder text */
::placeholder {
  color: #757575; /* 4.5:1 contrast ratio against white */
  opacity: 1;
}

/* Print styles for accessibility */
@media print {
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }
}
