/* === Base Reset & Typography === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent iOS Safari/Chrome from auto-scaling text on orientation change */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Smooth scrolling for in-page navigation */
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  min-height: 100dvh; /* Use dynamic viewport height for mobile browsers */
  /* Prevent pull-to-refresh interfering with vertical scroll */
  overscroll-behavior-y: contain;
}

a {
  color: var(--cf-orange);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.85;
}

/* Visible focus ring for keyboard navigation (accessibility) */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--cf-orange);
  outline-offset: 2px;
}

h1, h2, h3, h4 {
  line-height: 1.25;
  font-weight: 600;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
  /* Minimum touch target size per WCAG 2.5.8 / Apple HIG (44px) */
  min-height: 2.75rem; /* 44px */
  min-width: 2.75rem;  /* 44px */
  /* Remove iOS tap highlight */
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
  display: block;
}

/* Reduced motion preference — respect user OS setting */
@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;
  }
}

/* === Utility === */
.container {
  max-width: 80rem; /* 1280px in rem for scalability */
  margin: 0 auto;
  padding: 0 1.5rem;
}

.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;
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
