/* ==========================================================================
   Modern CSS Reset with Best Practices
   Mobile-First & Accessibility-Focused
   ========================================================================== */

/* ========================================
   Box Model Normalization
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

/* ========================================
   Remove Default Margins & Padding
   ======================================== */
* {
  margin: 0;
  padding: 0;
}

/* ========================================
   Root & Body Defaults
   ======================================== */
html {
  /* Enable smooth scrolling for better UX */
  scroll-behavior: smooth;
  /* Prevent font size adjustment on orientation change (iOS) */
  -webkit-text-size-adjust: 100%;
  /* Ensure consistent font rendering */
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  line-height: var(--line-height-normal);
  text-rendering: optimizeSpeed;
  /* Prevent horizontal scroll on mobile */
  overflow-x: hidden;
}

/* ========================================
   Typography Resets
   ======================================== */
/* Remove list styles */
ul, ol {
  list-style: none;
}

/* Improve heading defaults */
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Improve paragraph defaults */
p {
  overflow-wrap: break-word;
}

/* ========================================
   Media Elements
   ======================================== */
/* Make images and media responsive by default */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Prevent images from exceeding their container */
img {
  font-style: italic;  /* Alt text styling if image fails to load */
}

/* ========================================
   Form Elements
   ======================================== */
/* Inherit fonts for form controls */
input, button, textarea, select {
  font: inherit;
  color: inherit;
}

/* Remove button default styles */
button {
  background: none;
  border: none;
  cursor: pointer;
  /* Ensure buttons are tappable on touch devices */
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
}

/* Improve button accessibility */
button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Reset link styles */
a {
  text-decoration: none;
  color: inherit;
}

/* Improve link accessibility */
a:focus-visible {
  outline: 3px solid var(--color-accent-primary);
  outline-offset: 3px;
}

/* Textarea improvements */
textarea {
  resize: vertical;
  /* Prevent textarea from exceeding container */
  max-width: 100%;
}

/* ========================================
   Focus Management
   ======================================== */
/* Remove outline for mouse users only */
:focus:not(:focus-visible) {
  outline: none;
}

/* Ensure focus is visible for keyboard users */
:focus-visible {
  outline: 3px solid var(--color-accent-primary);
  outline-offset: 3px;
}

/* ========================================
   Performance & Accessibility
   ======================================== */
/* Reduce motion for users who prefer it */
@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;
  }
}

/* ========================================
   Utility Resets
   ======================================== */
/* Screen reader only content */
.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;
}

/* Hidden but maintain layout */
.invisible {
  visibility: hidden;
}

/* Remove from flow and visibility */
.hidden {
  display: none !important;
}