/* =====================================================================
   base.css — appliedbits element defaults
   Element-level resets and typographic baselines.
   Body defaults to serif per BRAND.md §6.
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--fg-primary);
  font-family: var(--font-serif);
  font-size: var(--fs-18);
  line-height: var(--lh-prose);
  font-weight: 400;
}

/* Headings — sans, sentence case (handled in copy, not CSS) */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: var(--tr-tight);
  margin: 0;
  color: var(--fg-display);
}

/* Editorial titles within prose use serif for warmer reading */
.entry-title {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: var(--tr-normal);
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

/* Links */
a {
  color: var(--fg-accent);
  text-decoration-color: var(--paper-300);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}
a:hover {
  color: var(--fg-accent-hover);
  text-decoration-color: var(--press-500);
}

/* Selection */
::selection {
  background: var(--press-100);
  color: var(--ink-950);
}

/* Inline code, monospace metadata */
code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

/* Inline emphasis */
em { font-style: italic; }
strong { font-weight: 600; }

/* Lists in prose context */
ul, ol {
  margin: 0 0 1em;
  padding-left: 1.5em;
}
li { margin-bottom: 0.35em; }

/* Block quotes — editorial, not pull quotes */
blockquote {
  margin: 1.5em 0;
  padding-left: 1em;
  border-left: 2px solid var(--paper-300);
  color: var(--fg-secondary);
  font-style: italic;
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--paper-200);
  margin: var(--s-6) 0;
}

/* Images */
img, svg, video {
  max-width: 100%;
  height: auto;
  display: block;
}

figure { margin: var(--s-5) 0; }
figcaption {
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  color: var(--fg-tertiary);
  margin-top: var(--s-2);
}

/* Code blocks */
pre {
  background: var(--bg-surface);
  border: 1px solid var(--bg-rule);
  padding: var(--s-4);
  overflow-x: auto;
  font-size: var(--fs-14);
  line-height: var(--lh-snug);
  margin: 1.25em 0;
}

/* Tables — sparingly used, but styled when present */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-16);
  margin: 1em 0;
}
th, td {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--bg-rule);
}
th {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--fs-14);
  text-transform: uppercase;
  letter-spacing: var(--tr-caps);
  color: var(--fg-secondary);
}

/* Focus styles — visible but not aggressive */
:focus-visible {
  outline: 2px solid var(--fg-accent);
  outline-offset: 2px;
}

/* Reduce motion if requested */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
