/* ==========================================================================
   1. RESET & BOX-SIZING
   ========================================================================== */

/* Use a more intuitive box-sizing model across all elements */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Prevent font size inflation after orientation changes in iOS */
html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

/* Remove default margin and set up consistent body layout */
body {
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   2. GLOBAL DESIGN TOKENS (VARIABLES)
   ========================================================================== */

:root {
  /* Color Palette */
  --clr-primary: #3b82f6;
  --clr-neutral-900: #0f172a;
  --clr-neutral-100: #f8fafc;
  --clr-bg: var(--clr-neutral-100);
  --clr-text: var(--clr-neutral-900);

  /* Typography */
  --ff-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --fs-base: 1rem;

  /* Layout */
  --max-width: 1200px;
  --container-padding: 1.5rem;
}

/* Base body styles using typography tokens */
body {
  font-family: var(--ff-sans);
  font-size: var(--fs-base);
  background-color: var(--clr-bg);
  color: var(--clr-text);
}

/* ==========================================================================
   3. TYPOGRAPHY & ELEMENTS RESET
   ========================================================================== */

/* Make headings balanced and legible */
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  line-height: 1.1;
  color: inherit;
}

/* Improve readability for paragraphs and lists */
p, li {
  text-wrap: pretty;
  max-width: 65ch; /* Keeps text lines at an optimal reading width */
}

/* Remove list styling where applicable */
ul, ol {
  list-style: none;
}

/* Clean links */
a {
  color: var(--clr-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Improve media defaults */
img, picture, svg, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Inherit fonts for inputs and buttons */
input, button, textarea, select {
  font: inherit;
}

/* ==========================================================================
   4. LAYOUT UTILITIES & ACCESSIBILITY
   ========================================================================== */

/* Standard responsive layout wrapper */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

/* Screen reader only utility class for accessibility */
.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;
}

/* Remove animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }
  
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
