/**
 * Base Styles - Reset and Typography
 * 
 * This file contains:
 * - CSS reset for consistent cross-browser rendering
 * - Base typography styles
 * - Font loading configuration
 * 
 * Requirements: 8.3
 */


/* ============================================
   CSS RESET
   ============================================
   Modern CSS reset for consistent baseline across browsers.
*/

/* Box sizing reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Remove default margins and padding */
body,
h1, h2, h3, h4, h5, h6,
p, blockquote, pre,
dl, dd, ol, ul,
figure, hr {
  margin: 0;
  padding: 0;
}

/* Remove list styles */
ol, ul {
  list-style: none;
}

/* Reset form elements */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* Remove button styling */
button {
  background: none;
  border: none;
  cursor: pointer;
}

/* Make images easier to work with */
img,
picture,
svg {
  max-width: 100%;
  display: block;
}

/* Remove default link styling */
a {
  color: inherit;
  text-decoration: none;
}

/* Smooth scrolling for anchor links */
html {
  scroll-behavior: smooth;
}

/* Prevent font size inflation on mobile */
html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}


/* ============================================
   BASE TYPOGRAPHY
   ============================================
   Typography system using system fonts for performance.
*/

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-main);
  background-color: var(--bg-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Heading styles */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin-bottom: var(--space-md);
}

h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: var(--space-md);
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: var(--space-sm);
}

h4 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  margin-bottom: var(--space-sm);
}

h5 {
  font-size: 1.125rem;
  margin-bottom: var(--space-xs);
}

h6 {
  font-size: 1rem;
  margin-bottom: var(--space-xs);
}

/* Paragraph styles */
p {
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
}

/* Strong and emphasis */
strong, b {
  font-weight: 700;
}

em, i {
  font-style: italic;
}

/* Code styles */
code,
pre {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
}

code {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

pre {
  background-color: rgba(0, 0, 0, 0.05);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

/* Blockquote styles */
blockquote {
  border-left: 4px solid var(--accent-soft);
  padding-left: var(--space-md);
  margin: var(--space-md) 0;
  font-style: italic;
  color: var(--text-secondary);
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--accent-soft);
  margin: var(--space-lg) 0;
}


/* ============================================
   FONT LOADING
   ============================================
   Using system fonts for optimal performance.
   If custom fonts are added later, use font-display: swap.
*/

/* Example for custom font loading (commented out):
@font-face {
  font-family: 'CustomFont';
  src: url('../assets/fonts/CustomFont.woff2') format('woff2'),
       url('../assets/fonts/CustomFont.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
*/


/* ============================================
   ACCESSIBILITY
   ============================================
   Base accessibility improvements.
*/

/* Focus styles for keyboard navigation */
:focus {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

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

/* Ensure focus is visible for keyboard users */
:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent-strong);
  color: white;
  padding: var(--space-xs) var(--space-sm);
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}


/* ============================================
   SELECTION STYLES
   ============================================
   Custom text selection colors.
*/

::selection {
  background-color: var(--accent-soft);
  color: white;
}

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