/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--text-color);
  background-color: var(--background-color);
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  margin-bottom: var(--spacing-md);
}

h1 {
  font-size: var(--font-size-5xl);
  font-weight: var(--font-weight-bold);
}

h2 {
  font-size: var(--font-size-4xl);
}

h3 {
  font-size: var(--font-size-3xl);
}

h4 {
  font-size: var(--font-size-2xl);
}

h5 {
  font-size: var(--font-size-xl);
}

h6 {
  font-size: var(--font-size-lg);
}

p {
  margin-bottom: var(--spacing-md);
  color: var(--light-text-color);
}

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

a:hover {
  color: var(--secondary-color);
}

/* Layout */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.section {
  padding: var(--section-padding);
}

.section-title {
  text-align: center;
  margin-bottom: var(--spacing-3xl);
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -var(--spacing-md);
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: var(--primary-color);
  border-radius: 0;
}

.section-title::before {
  content: '';
  position: absolute;
  bottom: -var(--spacing-md);
  left: calc(50% + 70px);
  width: 20px;
  height: 4px;
  background: var(--accent-color);
}

/* Utilities */
.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;
}

.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--border-color);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-gradient);
  border-radius: var(--border-radius);
}

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

/* Selection */
::selection {
  background: var(--primary-color);
  color: white;
}

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

/* Mobile-specific improvements */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Ensure text is readable on all devices */
body {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Prevent horizontal scrolling */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* Touch improvements for mobile */
button, a, input, select, textarea {
  -webkit-tap-highlight-color: transparent;
}

/* Image loading optimization for mobile */
img {
  /* Prevent layout shift while loading */
  background-color: #f0f0f0;
  /* Ensure images are visible during load */
  min-height: 100px;
  /* Better image rendering */
  image-rendering: auto;
  image-rendering: crisp-edges;
  image-rendering: -webkit-optimize-contrast;
}

/* Error handling for failed images */
img[alt*="Failed to load"], img[alt*="failed"], img[alt*="error"] {
  border: 3px solid #DD0100 !important;
  background-color: #f8d7da !important;
  color: #721c24 !important;
  font-size: 14px !important;
  padding: 10px !important;
  text-align: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Minimum touch target size for accessibility */
@media (max-width: 768px) {
  button, .nav-link, .social-link {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Mobile-specific image optimization */
  img {
    /* Force hardware acceleration for better performance */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    /* Ensure images fit mobile screens */
    max-width: calc(100vw - 40px) !important;
  }
  
  /* Photography grid mobile optimization */
  .photo-image {
    min-height: 200px !important;
    object-fit: cover !important;
  }
  
  /* Profile image mobile */
  #profile-image {
    max-width: 200px !important;
    height: auto !important;
  }
}