/**
 * Base Styles and Typography
 * Defines foundational styles and typography system
 * Requirements 8.1-8.7 - Typography and readability
 */

/* ===== Base HTML Elements ===== */

html {
  font-size: 16px; /* Base font size - Requirement 8.2 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  font-size: var(--font-size-base); /* 16px minimum - Requirement 8.2 */
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal); /* 1.5 - Requirement 8.3 */
  color: var(--color-text-primary);
  background-color: var(--color-bg-light);
}

/* ===== Typography Hierarchy ===== */
/* Requirement 8.4 - Clear typographic hierarchy */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin-bottom: var(--spacing-md);
  color: var(--color-text-primary);
}

h1 {
  font-size: var(--font-size-5xl); /* 48px */
  margin-bottom: var(--spacing-lg);
}

h2 {
  font-size: var(--font-size-4xl); /* 40px */
}

h3 {
  font-size: var(--font-size-3xl); /* 32px */
}

h4 {
  font-size: var(--font-size-2xl); /* 24px */
}

h5 {
  font-size: var(--font-size-xl); /* 20px */
}

h6 {
  font-size: var(--font-size-lg); /* 18px */
}

/* Responsive typography - smaller on mobile */
@media (max-width: 767px) {
  h1 {
    font-size: var(--font-size-4xl); /* 40px on mobile */
  }
  
  h2 {
    font-size: var(--font-size-3xl); /* 32px on mobile */
  }
  
  h3 {
    font-size: var(--font-size-2xl); /* 24px on mobile */
  }
}

/* ===== Paragraph and Text Elements ===== */

p {
  margin-bottom: var(--spacing-md);
  line-height: var(--line-height-relaxed); /* 1.75 - Requirement 8.3 */
  max-width: 70ch; /* Requirement 8.6 - Limit line length for readability */
  text-align: justify;
  text-justify: inter-word;
}

/* Text emphasis */
strong, b {
  font-weight: var(--font-weight-bold);
}

em, i {
  font-style: italic;
}

small {
  font-size: var(--font-size-sm);
}

/* ===== Links ===== */

a {
  color: var(--color-secondary-dark);
  text-decoration: none;
  transition: color var(--transition-base) var(--easing-default);
}

a:hover {
  color: var(--color-mid-tone);
}

a:focus-visible {
  outline: 2px solid var(--color-secondary-dark);
  outline-offset: 2px;
}

/* ===== Lists ===== */

ul, ol {
  margin-bottom: var(--spacing-md);
  padding-left: var(--spacing-xl);
}

ul {
  list-style-type: disc;
}

ol {
  list-style-type: decimal;
}

li {
  margin-bottom: var(--spacing-sm);
  line-height: var(--line-height-relaxed);
  text-align: justify;
  text-justify: inter-word;
}

/* ===== Code and Preformatted Text ===== */

code, pre {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: var(--font-size-sm);
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-sm);
}

code {
  padding: 0.125rem 0.25rem;
}

pre {
  padding: var(--spacing-md);
  overflow-x: auto;
  margin-bottom: var(--spacing-md);
}

pre code {
  background-color: transparent;
  padding: 0;
}

/* ===== Blockquotes ===== */

blockquote {
  margin: var(--spacing-xl) 0;
  padding-left: var(--spacing-lg);
  border-left: 4px solid var(--color-mid-tone);
  font-style: italic;
  color: var(--color-text-secondary);
}

/* ===== Horizontal Rule ===== */

hr {
  border: 0;
  height: 1px;
  background-color: var(--color-mid-tone);
  margin: var(--spacing-2xl) 0;
  opacity: 0.3;
}

/* ===== Selection ===== */

::selection {
  background-color: var(--color-light-accent);
  color: var(--color-primary-dark);
}

::-moz-selection {
  background-color: var(--color-light-accent);
  color: var(--color-primary-dark);
}

/* ===== Utility Classes ===== */

/* Text alignment */
.text-left {
  text-align: left;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

/* Text colors */
.text-primary {
  color: var(--color-text-primary);
}

.text-secondary {
  color: var(--color-text-secondary);
}

.text-light {
  color: var(--color-text-light);
}

/* Font weights */
.font-normal {
  font-weight: var(--font-weight-normal);
}

.font-light {
  font-weight: var(--font-weight-light);
}

.font-medium {
  font-weight: var(--font-weight-medium);
}

.font-semibold {
  font-weight: var(--font-weight-semibold);
}

.font-bold {
  font-weight: var(--font-weight-bold);
}

.italic {
  font-style: italic;
}

.not-italic {
  font-style: normal;
}

/* Screen reader only text - Requirement 10.1 */
.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 for keyboard navigation - Requirement 10.2 */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary-dark);
  color: var(--color-white);
  padding: var(--spacing-sm) var(--spacing-md);
  text-decoration: none;
  z-index: var(--z-index-tooltip);
}

.skip-to-content:focus {
  top: 0;
}

