/* Base typography - NYTimes style with web-safe fonts */
body {
  font-family: var(--font-serif);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-normal);
  color: var(--color-body-text);
  background-color: var(--color-bg);
  text-rendering: optimizeLegibility;
}

/* Headlines - Times New Roman, regular weight, tight leading */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--color-header-serif);
  letter-spacing: var(--ls-tight);
  margin-top: 0;
}

h1 {
  font-size: var(--text-h1);
  line-height: var(--lh-heading);
  margin-bottom: var(--space-3);
}

h2 {
  font-size: var(--text-h2);
  line-height: var(--lh-heading);
  margin-bottom: var(--space-2);
  margin-top: var(--space-6);
}

h3 {
  font-size: var(--text-h3);
  line-height: var(--lh-tight);
  margin-bottom: var(--space-2);
  margin-top: var(--space-4);
}

h4 {
  font-size: var(--text-h4);
  line-height: var(--lh-tight);
  margin-bottom: var(--space-1);
  margin-top: var(--space-4);
}

h5, h6 {
  font-size: var(--text-body);
  line-height: var(--lh-tight);
  margin-bottom: var(--space-1);
  margin-top: var(--space-3);
}

/* Paragraphs - generous spacing like NYTimes */
p {
  margin-bottom: var(--space-3);
  max-width: 665px;
}

/* First paragraph after heading - no extra top margin */
h1 + p, h2 + p, h3 + p, h4 + p {
  margin-top: 0;
}

/* Links */
a {
  color: var(--color-ui-active);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: color var(--transition-fast);
}

a:hover,
a:focus {
  color: var(--color-header-accent);
}

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

/* UI text - Sans-serif for navigation, buttons, meta */
.ui-text,
nav,
button,
.meta,
time,
.category-badge {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  letter-spacing: var(--ls-wide);
}

/* Pull quotes - larger, italic */
blockquote {
  font-family: var(--font-serif);
  font-size: var(--text-quote);
  font-style: italic;
  line-height: var(--lh-quote);
  color: var(--color-header-serif);
  border-left: 3px solid var(--color-header-accent);
  padding-left: var(--space-4);
  margin: var(--space-6) 0;
  max-width: 55ch;
}

blockquote p {
  margin-bottom: var(--space-2);
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Code - monospace */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-bg-elevated);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--color-ui-active);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--text-small);
  background: var(--color-bg-elevated);
  padding: var(--space-3);
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: var(--space-3);
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* Lists */
ul, ol {
  margin-bottom: var(--space-3);
  padding-left: var(--space-4);
  max-width: 665px;
}

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

li > ul,
li > ol {
  margin-top: 0.5em;
  margin-bottom: 0;
}

/* Strong and emphasis - only bold when using .bold class */
strong, b {
  font-weight: inherit;
}

.bold,
.font-bold {
  font-weight: 700;
}

em, i {
  font-style: italic;
}

/* Small text */
small {
  font-size: var(--text-small);
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--color-divider);
  margin: var(--space-6) 0;
}

/* Screen reader only */
.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 link */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  background: var(--color-header-accent);
  color: white;
  padding: var(--space-2) var(--space-3);
  border-radius: 4px;
  text-decoration: none;
  font-family: var(--font-sans);
  z-index: var(--z-tooltip);
}

.skip-link:focus {
  top: var(--space-2);
}
