/* ============================================
   CORE TYPOGRAPHY SYSTEM
   Base font definitions and variables
   ============================================ */

:root {
  /* Font Family System */
  --font-family-primary: "Vend Sans", sans-serif;
  --font-family-secondary: "Inter", system-ui, sans-serif;
  --font-family-mono: "SF Mono", Monaco, monospace;

  /* Base Font Sizes */
  --font-base: 16px;
  --font-scale: 1.25; /* Modular scale */
  --font-line-height: 1.6;

  /* Font Weight Scale */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-black: 900;

  /* Letter Spacing */
  --font-spacing-tight: -0.05em;
  --font-spacing-normal: 0;
  --font-spacing-wide: 0.025em;
  --font-spacing-wider: 0.05em;

  /* Heading Scale (Modular) */
  --font-size-h1: calc(
    var(--font-base) * var(--font-scale) * var(--font-scale) * var(--font-scale)
  );
  --font-size-h2: calc(
    var(--font-base) * var(--font-scale) * var(--font-scale)
  );
  --font-size-h3: calc(var(--font-base) * var(--font-scale));
  --font-size-h4: calc(var(--font-base) * 1.125);
  --font-size-h5: calc(var(--font-base) * 1.0625);
  --font-size-h6: var(--font-base);

  /* Text Scale */
  --font-size-lg: calc(var(--font-base) * 1.125);
  --font-size-base: var(--font-base);
  --font-size-sm: calc(var(--font-base) * 0.875);
  --font-size-xs: calc(var(--font-base) * 0.75);

  /* Line Heights */
  --line-height-tight: 1.25;
  --line-height-normal: var(--font-line-height);
  --line-height-relaxed: 1.75;

  /* Text Colors */
  --text-primary: var(--text-dark);
  --text-secondary: var(--text-light);
  --text-muted: var(--text-muted);
  --text-inverse: #ffffff;
}

/* ============================================
   BASE TYPOGRAPHY STYLES
   Applied to all elements
   ============================================ */

html {
  font-size: var(--font-base);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   HEADING TYPOGRAPHY
   Base heading styles
   ============================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-family-primary);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
  margin: 0 0 0.5em 0;
}

h1 {
  font-size: var(--font-size-h1);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--font-spacing-tight);
}

h2 {
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--font-spacing-normal);
}

h3 {
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--font-spacing-normal);
}

h4 {
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--font-spacing-normal);
}

h5 {
  font-size: var(--font-size-h5);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--font-spacing-normal);
}

h6 {
  font-size: var(--font-size-h6);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--font-spacing-wide);
  text-transform: uppercase;
}

/* ============================================
   TEXT ELEMENTS
   Base text styling
   ============================================ */

p {
  margin: 0 0 1em 0;
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

a {
  color: var(--secondary-color);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: var(--primary-color);
  text-decoration: underline;
}

/* Text Elements */
small,
.small {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

strong,
b {
  font-weight: var(--font-weight-semibold);
}

em,
i {
  font-style: italic;
}

/* ============================================
   LISTS
   Base list styling
   ============================================ */

ul,
ol {
  margin: 0 0 1em 0;
  padding-left: 1.5em;
}

li {
  margin-bottom: 0.5em;
  line-height: var(--line-height-normal);
}

/* ============================================
   CODE TYPOGRAPHY
   Code and monospace elements
   ============================================ */

code,
pre {
  font-family: var(--font-family-mono);
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

code {
  padding: 0.2em 0.4em;
}

pre {
  padding: 1em;
  overflow-x: auto;
  line-height: var(--line-height-relaxed);
}

/* ============================================
   ACCESSIBILITY BASE
   Screen reader and accessibility base
   ============================================ */

/* Screen reader only text */
.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;
}

/* Focus styles base */
*:focus {
  outline: 2px solid var(--secondary-color);
  outline-offset: 2px;
}

/* Skip links */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--secondary-color);
  color: var(--text-inverse);
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 10000;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 6px;
}
