/* ============================================
   BASE & RESET
   Shared base styles for web and admin
   ============================================ */

/* Global Reset - moved to top */

/* Global reset - use universal selector for base reset */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--navbar-height);
}

body {
  position: relative;
  min-height: 100vh;
}

/* Scroll snap is now handled in home.css for homepage only */

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* Body padding and background - handled by layout structure */
body:not(.admin-body) {
  padding-top: 0;
  margin-top: 0;
  background-color: #0f1929;
}

/* --- Focus Visible (Keyboard Navigation) --- */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn:focus-visible,
.nav-link:focus-visible,
.form-control:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), 0.25);
}

/* Hide focus for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* --- Reduced Motion (Accessibility) --- */
@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;
  }

  html {
    scroll-behavior: auto;
  }
}

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

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

/* --- Scrollbar Styling (WebKit) --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 4px;
}

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

/* Firefox Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) rgba(0, 0, 0, 0.1);
}

/* ============================================
   MOBILE OPTIMIZATIONS
   Mobile-specific enhancements (desktop unaffected)
   ============================================ */

/* Mobile - 768px and below */
@media (max-width: 768px) {
  /* Touch Action - Optimize touch interactions */
  button,
  a,
  input,
  select,
  textarea,
  .btn,
  .nav-link,
  .dropdown-item {
    touch-action: manipulation;
    /* Prevents double-tap zoom delay on iOS */
  }

  /* Safe Area Insets - iPhone X+ support */
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  /* Mobile Scroll Behavior */
  html {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  /* Prevent horizontal scroll on mobile */
  body {
    overflow-x: hidden;
    position: relative;
  }

  /* Mobile Font Size Base */
  html {
    font-size: 14px;
  }
}

/* Small Mobile - 576px and below */
@media (max-width: 576px) {
  /* Enhanced touch targets for small screens */
  button,
  .btn,
  .nav-link,
  input[type="button"],
  input[type="submit"],
  input[type="reset"] {
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
  }

  /* Safe area insets for small devices */
  body {
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
}