/**
 * AATec Summit Platform - Base Styles
 * 
 * Version: 1.0.0
 * Classification: Enterprise/Government Efficacy Standard
 * Compliance: WCAG 2.2 Level AAA
 * 
 * Foundational styles, resets, and layout utilities
 */

/* ============================================================================
   CSS RESET - MODERN NORMALIZE
   ============================================================================ */

/* Remove default margin and padding */
* {
  margin: 0;
  padding: 0;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Set default font and ensure proper rendering */
html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Remove list styles on ul, ol elements with a class */
ul[class],
ol[class] {
  list-style: none;
}

/* Make images easier to work with */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Remove built-in form typography styles */
input,
button,
textarea,
select {
  font: inherit;
}

/* Remove animations and transitions for users who prefer 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;
  }
}

/* ============================================================================
   LAYOUT UTILITIES
   ============================================================================ */

.container {
  width: 100%;
  max-width: var(--max-content-width, 1400px);
  margin-left: auto;
  margin-right: auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

.container-narrow {
  max-width: 900px;
}

.container-wide {
  max-width: 1600px;
}

/* Flex utilities */
.flex {
  display: flex;
}

.flex-column {
  flex-direction: column;
}

.flex-row {
  flex-direction: row;
}

.flex-center {
  align-items: center;
  justify-content: center;
}

.flex-between {
  justify-content: space-between;
}

.flex-around {
  justify-content: space-around;
}

.flex-gap-1 { gap: 0.5rem; }
.flex-gap-2 { gap: 1rem; }
.flex-gap-3 { gap: 1.5rem; }
.flex-gap-4 { gap: 2rem; }

/* Grid utilities */
.grid {
  display: grid;
}

.grid-gap-1 { gap: 0.5rem; }
.grid-gap-2 { gap: 1rem; }
.grid-gap-3 { gap: 1.5rem; }
.grid-gap-4 { gap: 2rem; }

/* ============================================================================
   SPACING UTILITIES
   ============================================================================ */

/* Margin */
.m-0 { margin: 0; }
.m-1 { margin: 0.5rem; }
.m-2 { margin: 1rem; }
.m-3 { margin: 1.5rem; }
.m-4 { margin: 2rem; }
.m-5 { margin: 3rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 3rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-5 { margin-bottom: 3rem; }

.ml-0 { margin-left: 0; }
.ml-1 { margin-left: 0.5rem; }
.ml-2 { margin-left: 1rem; }
.ml-auto { margin-left: auto; }

.mr-0 { margin-right: 0; }
.mr-1 { margin-right: 0.5rem; }
.mr-2 { margin-right: 1rem; }
.mr-auto { margin-right: auto; }

/* Padding */
.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }
.p-5 { padding: 3rem; }

.pt-0 { padding-top: 0; }
.pt-1 { padding-top: 0.5rem; }
.pt-2 { padding-top: 1rem; }
.pt-3 { padding-top: 1.5rem; }
.pt-4 { padding-top: 2rem; }

.pb-0 { padding-bottom: 0; }
.pb-1 { padding-bottom: 0.5rem; }
.pb-2 { padding-bottom: 1rem; }
.pb-3 { padding-bottom: 1.5rem; }
.pb-4 { padding-bottom: 2rem; }

/* ============================================================================
   TEXT UTILITIES
   ============================================================================ */

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

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

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

.text-uppercase {
  text-transform: uppercase;
}

.text-lowercase {
  text-transform: lowercase;
}

.text-capitalize {
  text-transform: capitalize;
}

.font-normal {
  font-weight: 400;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.text-small {
  font-size: 0.875rem;
}

.text-large {
  font-size: 1.25rem;
}

.text-xlarge {
  font-size: 1.5rem;
}

/* ============================================================================
   DISPLAY UTILITIES
   ============================================================================ */

.block {
  display: block;
}

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

.inline {
  display: inline;
}

.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}

/* Visibility utilities */
.invisible {
  visibility: hidden;
}

/* Screen reader only - accessible but invisible */
.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;
}

/* Make sr-only content focusable */
.sr-only-focusable:active,
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ============================================================================
   RESPONSIVE UTILITIES
   ============================================================================ */

/* Hide on mobile */
@media (max-width: 640px) {
  .hide-mobile {
    display: none !important;
  }
}

/* Hide on tablet */
@media (min-width: 641px) and (max-width: 1024px) {
  .hide-tablet {
    display: none !important;
  }
}

/* Hide on desktop */
@media (min-width: 1025px) {
  .hide-desktop {
    display: none !important;
  }
}

/* Show only on mobile */
.show-mobile {
  display: none !important;
}

@media (max-width: 640px) {
  .show-mobile {
    display: block !important;
  }
}

/* ============================================================================
   ACCESSIBILITY UTILITIES
   ============================================================================ */

/* Focus visible indicator - always show for keyboard navigation */
.focus-visible:focus {
  outline: 3px solid var(--focus-outline);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(255, 255, 0, 0.2);
}

/* Skip to content button styling */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--accent-primary);
  color: var(--bg-primary);
  padding: 1em 2em;
  font-weight: 700;
  text-decoration: none;
  z-index: 10000;
  border: 3px solid var(--bg-primary);
  border-radius: 0 0 4px 0;
}

.skip-to-content:focus {
  top: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  * {
    border-width: 2px !important;
  }
  
  button,
  .btn {
    border-width: 3px !important;
  }
}

/* Large text mode - user preference */
.large-text-mode {
  --base-font-size: 20px;
  letter-spacing: 0.12em;
}

.large-text-mode p {
  line-height: 1.8;
}

/* ============================================================================
   BACKGROUND UTILITIES
   ============================================================================ */

.bg-transparent {
  background-color: transparent;
}

.bg-primary {
  background-color: var(--bg-primary);
}

.bg-accent {
  background-color: rgba(255, 255, 0, 0.1);
}

.bg-subtle {
  background-color: rgba(255, 255, 255, 0.05);
}

/* ============================================================================
   BORDER UTILITIES
   ============================================================================ */

.border {
  border: 2px solid var(--border);
}

.border-top {
  border-top: 2px solid var(--border);
}

.border-bottom {
  border-bottom: 2px solid var(--border);
}

.border-left {
  border-left: 4px solid var(--accent-primary);
}

.border-accent {
  border-color: var(--accent-primary);
}

.border-subtle {
  border-color: var(--border-subtle);
}

.rounded {
  border-radius: 4px;
}

.rounded-lg {
  border-radius: 8px;
}

.rounded-full {
  border-radius: 9999px;
}

/* ============================================================================
   WIDTH & HEIGHT UTILITIES
   ============================================================================ */

.w-full {
  width: 100%;
}

.w-auto {
  width: auto;
}

.h-full {
  height: 100%;
}

.h-auto {
  height: auto;
}

.min-h-screen {
  min-height: 100vh;
}

/* ============================================================================
   POSITION UTILITIES
   ============================================================================ */

.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.fixed {
  position: fixed;
}

.sticky {
  position: sticky;
}

/* ============================================================================
   OVERFLOW UTILITIES
   ============================================================================ */

.overflow-auto {
  overflow: auto;
}

.overflow-hidden {
  overflow: hidden;
}

.overflow-x-auto {
  overflow-x: auto;
}

.overflow-y-auto {
  overflow-y: auto;
}

/* ============================================================================
   CURSOR UTILITIES
   ============================================================================ */

.cursor-pointer {
  cursor: pointer;
}

.cursor-not-allowed {
  cursor: not-allowed;
}

.cursor-help {
  cursor: help;
}

/* ============================================================================
   OPACITY UTILITIES
   ============================================================================ */

.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* ============================================================================
   SHADOW UTILITIES
   ============================================================================ */

.shadow-sm {
  box-shadow: 0 2px 4px rgba(255, 255, 0, 0.1);
}

.shadow {
  box-shadow: 0 4px 8px rgba(255, 255, 0, 0.2);
}

.shadow-lg {
  box-shadow: 0 8px 16px rgba(255, 255, 0, 0.3);
}

/* Remove shadows in high contrast mode */
@media (prefers-contrast: high) {
  .shadow-sm,
  .shadow,
  .shadow-lg {
    box-shadow: none;
  }
}

/* ============================================================================
   TRANSITIONS
   ============================================================================ */

.transition-none {
  transition: none;
}

.transition-fast {
  transition: all var(--transition-fast);
}

.transition-normal {
  transition: all var(--transition-normal);
}

.transition-slow {
  transition: all var(--transition-slow);
}

/* Disable transitions for reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .transition-fast,
  .transition-normal,
  .transition-slow {
    transition: none;
  }
}

/* ============================================================================
   SELECTION STYLES
   ============================================================================ */

::selection {
  background: var(--accent-primary);
  color: var(--bg-primary);
}

::-moz-selection {
  background: var(--accent-primary);
  color: var(--bg-primary);
}

/* ============================================================================
   SCROLLBAR STYLES - WCAG AAA COMPLIANT
   ============================================================================ */

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-primary) var(--bg-primary);
}

/* Chromium browsers */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border: 2px solid var(--bg-primary);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-secondary);
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
  /* Reset colors for print */
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  /* Hide interactive elements */
  button,
  .btn,
  nav,
  .skip-link,
  orion-assistant {
    display: none !important;
  }
  
  /* Ensure links are visible */
  a {
    text-decoration: underline;
  }
  
  /* Show URLs for external links */
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }
  
  /* Page breaks */
  h1, h2, h3 {
    page-break-after: avoid;
  }
  
  img, table, figure {
    page-break-inside: avoid;
  }
  
  /* Orphans and widows */
  p {
    orphans: 3;
    widows: 3;
  }
}

/* ============================================================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================================================ */

/* Ensure sufficient line height for readability - WCAG AAA */
p,
li,
td,
dd {
  line-height: var(--line-height, 1.6);
}

/* Ensure headings have proper spacing - WCAG AAA */
h1, h2, h3, h4, h5, h6 {
  margin-top: 1.5em;
  margin-bottom: 0.75em;
}

h1:first-child,
h2:first-child,
h3:first-child,
h4:first-child,
h5:first-child,
h6:first-child {
  margin-top: 0;
}

/* Ensure paragraphs have proper spacing - WCAG AAA */
p {
  margin-bottom: var(--paragraph-spacing, 2em);
}

p:last-child {
  margin-bottom: 0;
}

/* Ensure list items have proper spacing */
li {
  margin-bottom: 0.5em;
}

li:last-child {
  margin-bottom: 0;
}

/* ============================================================================
   FOCUS MANAGEMENT
   ============================================================================ */

/* Ensure focus is always visible - never use outline: none without replacement */
*:focus {
  outline: 3px solid var(--focus-outline);
  outline-offset: 2px;
}

/* Enhanced focus for interactive elements */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
summary:focus {
  outline: 3px solid var(--focus-outline);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(255, 255, 0, 0.2);
}

/* Focus visible only on keyboard navigation (for browsers that support it) */
*:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

*:focus-visible {
  outline: 3px solid var(--focus-outline);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(255, 255, 0, 0.2);
}

/* ============================================================================
   CONTENT REFLOW - WCAG AAA
   ============================================================================ */

/* Ensure content reflows at 320px width (WCAG AAA: 1.4.10 Reflow) */
@media (max-width: 320px) {
  body {
    font-size: 14px;
  }
  
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Ensure no horizontal scrolling */
  * {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }
}

/* ============================================================================
   USER PREFERENCES
   ============================================================================ */

/* Dark mode preference (though our primary theme is already dark) */
@media (prefers-color-scheme: dark) {
  /* Already using dark theme, no changes needed */
}

/* Light mode preference (future low-contrast theme) */
@media (prefers-color-scheme: light) {
  /* Low-contrast theme would be defined here in future */
  /* For now, maintain high-contrast dark theme */
}

/* Reduced transparency for accessibility */
@media (prefers-reduced-transparency: reduce) {
  * {
    backdrop-filter: none !important;
    background-blend-mode: normal !important;
  }
}

/* ============================================================================
   INTERACTION STATES
   ============================================================================ */

/* Hover states - only apply on devices that support hover */
@media (hover: hover) {
  a:hover,
  button:hover,
  .btn:hover {
    /* Hover styles defined in individual components */
  }
}

/* Touch-friendly tap highlights */
@media (hover: none) {
  a,
  button,
  .btn {
    -webkit-tap-highlight-color: rgba(255, 255, 0, 0.3);
  }
}

/* ============================================================================
   LANDMARK REGIONS - ENSURE PROPER SEMANTICS
   ============================================================================ */

/* Landmarks should be semantic HTML elements */
header[role="banner"],
nav[role="navigation"],
main[role="main"],
aside[role="complementary"],
footer[role="contentinfo"] {
  /* Roles are redundant on semantic elements but included for older browsers */
}

/* ============================================================================
   KEYBOARD NAVIGATION ENHANCEMENTS
   ============================================================================ */

/* Ensure all interactive elements are keyboard accessible */
a,
button,
input,
select,
textarea,
summary,
[tabindex]:not([tabindex="-1"]) {
  /* Focusable elements should not have tabindex="-1" unless intentional */
}

/* Highlight keyboard focus clearly */
body:not(.using-mouse) *:focus {
  outline: 3px solid var(--focus-outline);
  outline-offset: 2px;
}

/* Track mouse usage to adjust focus indicators */
body.using-mouse *:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================================================
   REDUCED DATA MODE
   ============================================================================ */

@media (prefers-reduced-data: reduce) {
  /* Don't load large background images */
  * {
    background-image: none !important;
  }
  
  /* Don't load web fonts, use system fonts only */
  @font-face {
    font-display: optional;
  }
}
