/* PAA NMR notes: simple, accessible stylesheet (WCAG 2.1 AA) */

:root {
  --ink: #1a1a1a;
  --muted: #4b5563;          /* 7.6:1 on white */
  --bg: #fdfdfc;
  --panel: #f3f4f6;
  --rule: #d1d5db;
  --accent: #1d4ed8;         /* 6.7:1 on white */
  --accent-visited: #6b21a8; /* 8.6:1 on white */
  --warm: #b45309;           /* 5.0:1 on white */
  --focus: #b45309;
  --measure: 46rem;
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", serif;
  font-size: 1.125rem;
  line-height: 1.65;
}

h1, h2, h3, .kicker, .byline, nav, figcaption, table, .note, .callout-title, .site-footer {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Skip link: visible on focus */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
}
.skip-link:focus { top: 1rem; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--rule);
  padding: 2.5rem 0 1.5rem;
  background: #fff;
}
.kicker {
  margin: 0 0 0.5rem;
  color: var(--warm);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  line-height: 1.2;
  font-weight: 700;
}
.byline {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Table of contents */
.toc {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 0.98rem;
}
.toc h2 {
  font-size: 1rem;
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-weight: 600;
}
.toc ol {
  margin: 0;
  padding-left: 1.4rem;
  columns: 2 16rem;
  column-gap: 2rem;
}
.toc li { margin: 0.15rem 0; break-inside: avoid; }

/* Main content */
main { padding-bottom: 3rem; }
main:focus { outline: none; }

section { margin-top: 2.75rem; }

h2 {
  font-size: 1.5rem;
  line-height: 1.3;
  margin: 0 0 0.8rem;
  padding-top: 0.25rem;
  border-top: 2px solid var(--ink);
}
h3 {
  font-size: 1.15rem;
  line-height: 1.35;
  margin: 1.75rem 0 0.4rem;
}

p, ul, ol { margin: 0 0 1rem; }
li { margin: 0.35rem 0; }

sub, sup { font-size: 0.72em; line-height: 0; }

a { color: var(--accent); text-underline-offset: 0.15em; }
a:visited { color: var(--accent-visited); }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

a.cite { text-decoration: none; }
a.cite:hover, a.cite:focus-visible { text-decoration: underline; }

.note {
  margin-top: 2rem;
  padding: 0.9rem 1.1rem;
  background: var(--panel);
  border-left: 4px solid var(--warm);
  font-size: 0.95rem;
}

/* Figures */
figure {
  margin: 1.75rem 0;
}
figure img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.fig-link { display: block; border-radius: 6px; }
figcaption {
  margin-top: 0.6rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink);
}

/* Tables */
.table-scroll {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: #fff;
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 36rem;
  font-size: 0.92rem;
}
caption {
  caption-side: top;
  text-align: left;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--rule);
}
th, td {
  padding: 0.55rem 0.9rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}
thead th { background: var(--panel); font-weight: 600; }
tbody tr:last-child th,
tbody tr:last-child td { border-bottom: 0; }
tbody th { font-weight: 600; white-space: nowrap; }

/* Callout */
.callout {
  margin: 1.75rem 0;
  padding: 1rem 1.25rem;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: #eff4ff;
}
.callout-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  color: var(--accent);
}
.callout p { margin: 0; }

/* References */
.refs { padding-left: 1.6rem; font-size: 0.98rem; }
.refs li { margin: 0.6rem 0; }
.refs li:target { background: #fff7e6; outline: 2px solid var(--warm); outline-offset: 4px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  background: #fff;
  padding: 2rem 0 2.5rem;
  font-size: 0.95rem;
}
.footer-heading { font-size: 1.05rem; border: 0; margin-bottom: 0.5rem; }
.small { color: var(--muted); font-size: 0.875rem; }

/* Respect motion preferences (no animations are used, but keep smooth scroll opt-in) */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media (max-width: 30rem) {
  body { font-size: 1.0625rem; }
  .site-header { padding-top: 1.75rem; }
}

/* Print */
@media print {
  .skip-link, .toc { display: none; }
  body { background: #fff; font-size: 11pt; }
  a { color: inherit; }
  .refs a::after { content: " (" attr(href) ")"; font-size: 0.85em; }
  figure, table, .callout { break-inside: avoid; }
}
