/* ============================================
   Additional Mobile Optimizations
   Performance and UX enhancements for mobile
   ============================================ */

/* ============================================
   VIEWPORT & META OPTIMIZATIONS
   ============================================ */

/* Ensure proper viewport handling */
/* @viewport is deprecated - use meta viewport tag in HTML instead */
/* @viewport {
  width: device-width;
  initial-scale: 1.0;
  maximum-scale: 5.0;
  user-scalable: yes;
} */

/* ============================================
   TOUCH OPTIMIZATIONS
   ============================================ */

/* Improve touch scrolling */
* {
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: rgba(0, 74, 173, 0.1);
}

/* Remove tap highlight on buttons and links */
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

/* Touch-friendly focus states */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Reduce repaints on mobile */
@media (max-width: 768px) {
  /* Use transform instead of position changes */
  .btn:active,
  a:active {
    transform: scale(0.98);
  }
  
  /* Optimize animations */
  * {
    will-change: auto;
  }
  
  /* 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;
    }
  }
}

/* ============================================
   IMAGE OPTIMIZATIONS
   ============================================ */

/* Responsive images */
img {
  max-width: 100%;
  height: auto;
 
}

/* Lazy loading support */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Image containers */
.image-container {
  position: relative;
  overflow: hidden;
  width: 100%;
}

.image-container img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* ============================================
   TYPOGRAPHY OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
  /* Improve text rendering on mobile */
  body {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  
  /* Prevent text size adjustment on iOS */
  html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    /* text-size-adjust is not widely supported - use -webkit-text-size-adjust instead */
    /* text-size-adjust: 100%; */
  }
  
  /* Headings: use All.css rhythm — no global h1–h6 overrides here */
}

/* ============================================
   FORM OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
  /* Full-width forms on mobile */
  form {
    width: 100%;
  }
  
  .form-group {
    margin-bottom: 1.5rem;
  }
  
  /* Better input spacing */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="date"],
  input[type="password"],
  textarea,
  select {
    width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 8px;
  }
  
  /* Better select styling */
  select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
  }
  
  /* Better checkbox and radio */
  input[type="checkbox"],
  input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    position: relative;
  }
  
  input[type="checkbox"]:checked,
  input[type="radio"]:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
  }
  
  input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
  }
  
  input[type="radio"] {
    border-radius: 50%;
  }
  
  input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
  }
}

/* ============================================
   LAYOUT OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
  /* Remove horizontal scrolling */
  body {
    overflow-x: hidden;
    width: 100%;
  }
  
  /* Full-width containers */
  .container {
    width: 100%;
    padding: 0 1rem;
    box-sizing: border-box;
  }
  
  /* Stack elements vertically */
  .row,
  .flex-row {
    flex-direction: column;
  }
  
  /* Full-width cards */
  .card,
  .news-card,
  .story-card {
    width: 100%;
    margin-bottom: 1.5rem;
  }
  
  /* Better grid on mobile */
  .grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  /* Tables become scrollable */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }
  
  table thead,
  table tbody,
  table tr {
    display: block;
  }
  
  table th,
  table td {
    display: block;
    text-align: left;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
  }
  
  table th {
    font-weight: bold;
    background: var(--bg-light);
  }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

@media (max-width: 768px) {
  /* Larger touch targets */
  button,
  a,
  input[type="button"],
  input[type="submit"],
  input[type="reset"] {
    min-height: 44px;
    min-width: 44px;
    padding: 0.75rem 1.5rem;
  }
  
  /* Better focus indicators */
  *:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
  }
  
  /* Skip to content link */
  .skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    z-index: 10000;
  }
  
  .skip-to-content:focus {
    top: 0;
  }
}

/* ============================================
   LOADING STATES
   ============================================ */

/* Skeleton loading for mobile */
.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ============================================
   SWIPE GESTURES SUPPORT
   ============================================ */

@media (max-width: 768px) {
  /* Swipeable containers */
  .swipeable {
    touch-action: pan-y;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Prevent pull-to-refresh on specific elements */
  .no-pull-refresh {
    overscroll-behavior: contain;
  }
}

/* ============================================
   SAFE AREA SUPPORT (iOS)
   ============================================ */

@supports (padding: max(0px)) {
  @media (max-width: 768px) {
    /*.header {
      
      height: 167px;
    }
    */
    .header-brand{
      height: 134px;
      position: relative;
      right: 60px;
      top: 10px;
    }

    
    .footer {
      padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    .mobile-nav {
      padding-top: max(1rem, env(safe-area-inset-top));
    }
  }
}



/* ============================================
   
   ============================================ */



@media (max-width: 1200px) {
  .header .logo {
    font-size: 1.2rem;
  }
}

@media (max-width: 768px) {
  .header .logo {
    font-size: 0.95rem;
  }

  .logo{
    width: 145px;
    bottom: 25px;
  }

  #intro .introduction{
    width: 100%;
    overflow: hidden;
    font-size: 18px;
  }

  #news-events .section{
    width: 100%;
    display: grid;

  }
}

@media (max-width: 480px) {
  .header .logo {
    font-size: 0.85rem;
  }
}

@media(max-width: 360px){
  .header .logo {
    font-size: 0.75rem;
  }

  .logo{
    width: 145px;
    bottom: 25px;
  }


}

/* Tablet specific fixes */
@media (min-width: 481px) and (max-width: 768px) {
  .container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  
  .news-card,
  .story-card {
    width: 100% !important;
    max-width: 100% !important;
  }
}