/* peterstewart.me · "Proof sheet" */

@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-var.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/instrument-sans-var.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #F7F5F0;
  --ink: #1B1D1F;
  --ink-2: #43494F;
  --muted: #5C636A;
  --rule: #E6E1D8;
  --rule-strong: #CFC8BB;
  --accent: #0E5866;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --measure: 44rem;
  --pair-col: 10.5rem; /* label column shared by the Work rows and the Career and Education timelines, so their text lines up */
  --gutter: clamp(20px, 5vw, 48px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111416;
    --ink: #ECE8E1;
    --ink-2: #BFC3C7;
    --muted: #959CA2;
    --rule: #23292C;
    --rule-strong: #3A4247;
    --accent: #7CC5CE;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111416;
  --ink: #ECE8E1;
  --ink-2: #BFC3C7;
  --muted: #959CA2;
  --rule: #23292C;
  --rule-strong: #3A4247;
  --accent: #7CC5CE;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 1.125rem;
  line-height: 1.6;
  font-kerning: normal;
  font-variant-numeric: lining-nums;
  text-rendering: optimizeLegibility;
  font-synthesis-weight: none;
}
h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }
img, svg { display: inline-block; vertical-align: middle; }

a { color: var(--accent); text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.wrap { width: 100%; max-width: calc(70rem + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

.skip-link {
  position: absolute; left: var(--gutter); top: 12px; z-index: 10;
  padding: 10px 16px; background: var(--ink); color: var(--bg);
  font-family: var(--sans); font-size: 0.9375rem; text-decoration: none; border-radius: 6px;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* Small tracked capitals used for labels */
.eyebrow, .facts dt, .points dt, .section-label, .value-num {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.meta { font-family: var(--sans); font-size: 0.9375rem; line-height: 1.5; color: var(--muted); }

/* ---------- Header ---------- */
.site-header { display: flex; align-items: center; gap: 24px; padding-block: 20px; }
.wordmark { font-size: 1.1875rem; font-weight: 500; color: var(--ink); text-decoration: none; margin-right: auto; }
.site-nav { display: none; }
.site-nav ul { display: flex; gap: 28px; list-style: none; margin: 0; padding: 0; }
.site-nav a { font-family: var(--sans); font-size: 0.875rem; color: var(--ink-2); text-decoration: none; }
.site-nav a:hover { color: var(--ink); text-decoration: underline; }
@media (min-width: 760px) { .site-nav { display: block; } }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 44px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--rule-strong); border-radius: 999px;
  background: transparent; color: var(--ink);
  font-family: var(--sans); font-size: 0.875rem; cursor: pointer;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { border-color: var(--ink-2); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle[data-mode="dark"] .icon-sun { display: inline-block; }
.theme-toggle[data-mode="dark"] .icon-moon { display: none; }
@media (max-width: 759.98px) {
  .theme-toggle { padding: 0; }
  .theme-toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* ---------- Hero ---------- */
.hero { padding-top: clamp(40px, 7vw, 104px); padding-bottom: clamp(56px, 8vw, 112px); }
.eyebrow { color: var(--accent); font-weight: 500; font-size: clamp(0.75rem, 0.7rem + 0.2vw, 0.875rem); }
.hero h1 {
  margin-top: clamp(16px, 2vw, 28px);
  font-size: clamp(2.625rem, 1.2rem + 6.2vw, 6.625rem);
  line-height: 0.98;
  font-weight: 400;
  letter-spacing: -0.028em;
}
.thesis-line { display: block; }
.thesis-turn { font-style: italic; }
@media (min-width: 600px) { .thesis-turn { padding-left: 1.1em; } }
.qed {
  display: inline-block;
  width: 0.3em; height: 0.3em;
  margin-left: 0.12em;
  background: var(--accent);
  vertical-align: 0;
}
.lede strong { font-weight: 500; }
.nowrap { white-space: nowrap; }
.lede { margin-top: clamp(24px, 3vw, 40px); max-width: 56rem; font-size: clamp(1.4375rem, 1.15rem + 1.1vw, 2rem); line-height: 1.35; }
.byline { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; margin-top: clamp(24px, 3vw, 40px); }
@media (min-width: 600px) { .byline { flex-direction: row; gap: clamp(16px, 2.4vw, 28px); } }
.byline .lede { margin-top: 0; }
.byline-text { min-width: 0; max-width: 56rem; }
.byline .intro { max-width: none; }
.avatar { flex: none; width: clamp(64px, 7vw, 104px); height: auto; aspect-ratio: 1; border-radius: 50%; box-shadow: 0 0 0 1px var(--rule-strong); margin-top: 0.3em; }
.intro { margin-top: clamp(16px, 2vw, 24px); max-width: 47.5rem; font-size: clamp(1.125rem, 0.75rem + 1vw, 1.5rem); color: var(--ink-2); }

.facts { margin-top: clamp(40px, 5vw, 72px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px 40px; }
.facts > div { border-top: 1px solid var(--rule-strong); padding-top: 16px; }
.facts dt { color: var(--accent); }
.facts dd { margin-top: 8px; font-size: 1.1875rem; line-height: 1.4; }
@media (min-width: 600px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 28px; } }
@media (min-width: 1000px) { .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } .facts dd { font-size: 1.25rem; } }

.link-row { display: flex; flex-wrap: wrap; gap: 4px 28px; margin-top: clamp(28px, 4vw, 48px); font-family: var(--sans); font-weight: 500; font-size: 1rem; }
.link-row a { display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- Sections ---------- */
.section { position: relative; padding-block: clamp(48px, 7vw, 88px); }
.section::before {
  content: ""; position: absolute; left: var(--gutter); right: var(--gutter); top: 0;
  border-top: 1px solid var(--rule);
}
.section-label { display: flex; align-items: baseline; gap: 10px; color: var(--muted); }
.section-num { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.375rem; letter-spacing: 0; text-transform: none; color: var(--accent); }
.section-body { margin-top: 14px; min-width: 0; }
@media (min-width: 900px) {
  .section { display: grid; grid-template-columns: 10.5rem minmax(0, 1fr); column-gap: 48px; }
  .section-label { flex-direction: column; gap: 6px; }
  .section-num { font-size: 1.5rem; }
  .section-body { margin-top: 0; }
}

h2 { font-size: clamp(2rem, 1.45rem + 1.7vw, 2.875rem); line-height: 1.1; font-weight: 400; letter-spacing: -0.015em; text-wrap: balance; }
h2 + .meta { margin-top: 12px; }
h3 { font-size: clamp(1.4375rem, 1.3rem + 0.4vw, 1.6875rem); line-height: 1.2; font-weight: 500; }
.section-intro { margin-top: clamp(20px, 2.5vw, 32px); max-width: var(--measure); font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem); line-height: 1.45; }

/* Work: label + statement pairs */
.points { margin-top: clamp(28px, 3.5vw, 44px); max-width: 50rem; display: grid; gap: 24px; }
.points dt { color: var(--accent); }
.points dd { margin-top: 4px; }
@media (min-width: 640px) {
  .points > div { display: grid; grid-template-columns: var(--pair-col) minmax(0, 1fr); column-gap: 24px; }
  .points dt { padding-top: 0.3em; }
  .points dd { margin-top: 0; font-size: 1.1875rem; }
}

/* Leadership: values set like theorem statements */
.values { margin-top: clamp(32px, 4vw, 48px); display: grid; gap: 40px 64px; }
@media (min-width: 760px) { .values { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 52px; } }
.value-num { color: var(--muted); }
.value-statement { margin-top: 10px; font-style: italic; font-size: clamp(1.5rem, 1.35rem + 0.5vw, 1.75rem); line-height: 1.25; }
.value-gloss { margin-top: 12px; color: var(--ink-2); }
.closing {
  margin-top: clamp(40px, 5vw, 64px); padding-top: 28px; max-width: 48.75rem;
  border-top: 1px solid var(--rule-strong);
  font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.6875rem); line-height: 1.45;
}

/* Career timeline: years in their own column, one hairline per row */
.timeline { margin-top: clamp(28px, 3.5vw, 44px); max-width: 50rem; list-style: none; padding: 0; }
.timeline > li { display: grid; gap: 4px 24px; padding-block: 22px; border-top: 1px solid var(--rule); }
.timeline > li:last-child { border-bottom: 1px solid var(--rule); }
.tl-years { font-family: var(--sans); font-size: 0.875rem; font-weight: 500; letter-spacing: 0.02em; color: var(--accent); font-variant-numeric: tabular-nums; padding-top: 0.35em; }
.tl-body h3 { font-size: clamp(1.3125rem, 1.2rem + 0.35vw, 1.5rem); }
.tl-body .meta { margin-top: 4px; }
.tl-body .meta + p { margin-top: 10px; }
@media (min-width: 640px) { .timeline > li { grid-template-columns: var(--pair-col) minmax(0, 1fr); } }

/* Projects */
.projects { margin-top: clamp(28px, 3.5vw, 44px); max-width: 47.5rem; display: grid; gap: 40px; }
.project { border-top: 1px solid var(--rule-strong); padding-top: 22px; }
.project .meta { margin-top: 8px; }
.project .meta + p { margin-top: 12px; }
.project .link-row { margin-top: 6px; }

/* Education */
.education { margin-top: clamp(28px, 3.5vw, 44px); max-width: 50rem; display: grid; gap: 28px; }
.education .timeline { margin-top: 0; }
.tl-body .degree { margin-top: 4px; font-size: 1.1875rem; line-height: 1.45; }
.tl-body .degree + .meta { margin-top: 4px; }
.citation {
  margin-top: 4px; padding-top: 4px;
  display: grid; grid-template-columns: 2.75rem minmax(0, 1fr); column-gap: 8px;
  color: var(--ink-2);
}
.citation strong { font-weight: 500; color: var(--ink); }
.citation-num { color: var(--accent); }
.citation cite { font-style: italic; }
.doi { font-family: var(--sans); font-weight: 500; font-size: 0.9375rem; overflow-wrap: anywhere; }

/* Contact */
.email { margin-top: 24px; font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem); overflow-wrap: anywhere; }
.email a { text-underline-offset: 0.25em; }
#contact .link-row { margin-top: 16px; }

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding-block: 28px 48px;
  font-family: var(--sans); font-size: 0.875rem; color: var(--muted);
}
.site-footer::before { content: ""; position: absolute; left: var(--gutter); right: var(--gutter); top: 0; border-top: 1px solid var(--rule); }
.site-footer a { color: var(--muted); display: inline-flex; align-items: center; min-height: 44px; margin-block: -12px; }

/* ---------- 404 ---------- */
.not-found { padding-block: clamp(64px, 12vw, 160px); }
.not-found h1 { font-size: clamp(2.75rem, 2rem + 3vw, 4.5rem); line-height: 1.05; font-weight: 400; letter-spacing: -0.02em; }
.not-found p { margin-top: 20px; font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem); }

/* ---------- Print: a clean resume-style document ---------- */
@media print {
  :root, :root[data-theme="dark"] {
    --bg: #fff; --ink: #000; --ink-2: #222; --muted: #444; --rule: #bbb; --rule-strong: #999; --accent: #0E5866;
    color-scheme: light;
  }
  @page { margin: 13mm 15mm; }
  body { font-size: 9.75pt; line-height: 1.4; }
  .skip-link, .site-nav, .theme-toggle, .wordmark, .hero .link-row, .site-footer p:last-child { display: none !important; }
  .site-header { padding-block: 0; }
  .hero { padding-block: 0 10pt; }
  .eyebrow { font-size: 7.5pt; }
  .hero h1 { font-size: 24pt; margin-top: 3pt; }
  .thesis-turn { padding-left: 0; }
  .lede { font-size: 12pt; margin-top: 6pt; max-width: none; }
  .byline { margin-top: 6pt; }
  .avatar { display: none; }
  .intro { font-size: 9.75pt; margin-top: 4pt; max-width: none; }
  .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 10pt; gap: 6pt 12pt; }
  .facts > div { padding-top: 5pt; }
  .facts dt, .points dt, .section-label, .value-num { font-size: 7pt; }
  .facts dd { font-size: 9pt; margin-top: 2pt; }
  .section { display: grid; grid-template-columns: 24mm minmax(0, 1fr); column-gap: 6mm; padding-block: 9pt; }
  .section-label { flex-direction: column; gap: 1pt; }
  .section-num { font-size: 11pt; }
  .section-body { margin-top: 0; }
  h2 { font-size: 14pt; }
  h3 { font-size: 11pt; }
  .tl-body .degree { font-size: 10pt; margin-top: 1pt; }
  .meta { font-size: 8.5pt; }
  h2 + .meta { margin-top: 3pt; }
  .section-intro, .closing { font-size: 10.5pt; margin-top: 5pt; max-width: none; }
  .closing { padding-top: 6pt; }
  .points, .values, .timeline, .projects, .education { margin-top: 7pt; gap: 6pt 12pt; max-width: none; }
  .timeline > li { grid-template-columns: 27mm minmax(0, 1fr); column-gap: 4mm; padding-block: 5pt; }
  .qed { background: #0E5866; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .points > div { display: grid; grid-template-columns: 27mm minmax(0, 1fr); column-gap: 4mm; }
  .points dt { padding-top: 0.15em; }
  .points dd { font-size: 9.75pt; margin-top: 0; }
  .values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .value-statement { font-size: 11pt; margin-top: 2pt; }
  .value-gloss { margin-top: 2pt; }
  .project .meta { margin-top: 1pt; }
  .project .meta + p { margin-top: 3pt; }
  .project { padding-top: 6pt; }
  .citation { margin-top: 2pt; padding-top: 6pt; }
  .points > div, .timeline > li, .project, .values li, .citation { break-inside: avoid; }
  h2, h3, .section-intro, .meta:not(:last-child) { break-after: avoid; }
  .email { font-size: 11pt; margin-top: 4pt; }
  #contact .link-row { margin-top: 2pt; }
  .project .link-row { margin-top: 2pt; font-size: 8.5pt; gap: 0 10pt; }
  #contact .link-row a::after { content: " (" attr(href) ")"; font-weight: 400; }
  .link-row a { display: inline; min-height: 0; }
  a { color: var(--ink); text-decoration: none; }
  .site-footer { padding-block: 6pt 0; font-size: 8pt; }
}
