/* 
 * Modern CSS Reset
 * Mobile-First Foundation
 * Based on Josh Comeau's CSS Reset + Mobile-First Best Practices
 */

/* Use border-box sizing by default */
*, *::before, *::after {
  box-sizing: border-box;
}

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

/* 
 * Core HTML/Body Setup
 * - 100% height for proper layout
 * - Line height for readability (especially on mobile)
 * - Smooth font rendering
 */
html {
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent font size adjustment on orientation change (iOS) */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100%;
  line-height: 1.5;
  /* Prevent horizontal scroll on mobile */
  overflow-x: hidden;
}

/* 
 * Media Elements
 * - Responsive by default
 * - Display as block (removes inline spacing issues)
 */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* 
 * Form Elements
 * - Inherit font from parent
 * - Remove iOS rounded corners and shadows
 */
input, button, textarea, select {
  font: inherit;
  /* Remove iOS default styling */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  /* Remove iOS inner shadow */
  background-color: transparent;
  border: none;
}

/* 
 * Buttons
 * - Cursor pointer for better UX
 * - Remove iOS touch highlight
 */
button {
  cursor: pointer;
  /* Remove iOS tap highlight */
  -webkit-tap-highlight-color: transparent;
}

/* Disable tap highlight on all interactive elements */
a, button, input, select, textarea {
  -webkit-tap-highlight-color: transparent;
}

/* 
 * Links
 * - Inherit color (style them explicitly elsewhere)
 * - Remove underline (add back selectively)
 */
a {
  color: inherit;
  text-decoration: none;
}

/* 
 * Typography
 * - Prevent text overflow
 * - Better word breaking on mobile
 */
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  /* Hyphens for narrow screens */
  hyphens: auto;
}

/* 
 * Lists
 * - Remove default list styling (add back when needed)
 */
ul, ol {
  list-style: none;
}

/* 
 * Tables
 * - Better default spacing
 */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* 
 * Remove default focus outline
 * IMPORTANT: Add custom focus styles in main.css for accessibility
 */
:focus {
  outline: none;
}

/* But keep it for keyboard navigation */
:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* 
 * Fieldset reset
 */
fieldset {
  border: none;
  padding: 0;
  margin: 0;
  min-width: 0;
}

/* 
 * iOS Safari: Prevent zoom on input focus
 * (only if font-size is at least 16px in main.css)
 */
@media screen and (max-width: 767px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px; /* Prevents iOS zoom */
  }
}

/* 
 * Improve text rendering
 */
body {
  text-rendering: optimizeSpeed;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* 
 * Reduced motion preferences
 * Remove animations 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;
  }
}
