/* ==========================================================================
   NexsoLabs Base Styles & Accessibility Foundation
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--trans-base), color var(--trans-base);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-primary);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-indigo);
}

/* Text Selection */
::selection {
  background: var(--accent-indigo);
  color: #FFFFFF;
}

/* Accessible Focus Outlines (WCAG 2.1 AA) */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Skip to main content link for keyboard / screen-reader accessibility */
.skip-link {
  position: absolute;
  top: -60px;
  left: 20px;
  background: var(--grad-primary);
  color: #FFFFFF;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  z-index: 9999;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  transition: top var(--trans-fast);
}
.skip-link:focus {
  top: 15px;
}

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

/* Responsive Containers */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1rem, 4vw, 2.5rem);
  padding-right: clamp(1rem, 4vw, 2.5rem);
}

/* Typography Hierarchy with fluid clamp() */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.2rem, 5vw + 0.5rem, 3.75rem);
}
h2 {
  font-size: clamp(1.8rem, 3.5vw + 0.3rem, 2.75rem);
}
h3 {
  font-size: clamp(1.3rem, 2vw + 0.2rem, 1.75rem);
}
h4 {
  font-size: clamp(1.1rem, 1.5vw, 1.35rem);
}

p {
  color: var(--text-secondary);
  font-size: clamp(1rem, 1vw + 0.2rem, 1.125rem);
  line-height: 1.7;
}

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

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

ul, ol {
  list-style: none;
}

/* Respect user's 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;
  }
}
