/* ---------- Webfont: Newsreader (self-hosted, variable weight) ---------- */
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-latin-standard-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-latin-standard-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}


/* ---------- Design tokens: edit these to restyle the whole site ---------- */
:root {
  --font-body: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --measure: 62ch;      /* max line length for text */
  --page-width: 56rem;  /* overall content width */
  --space: 2.5rem;
  --radius: 6px;
}

/* Light theme (default) */
:root,
:root[data-theme="light"] {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1b2430;
  --muted: #5b6675;
  --line: #d9dee5;
  --accent: #2f5d8a;
  --accent-contrast: #ffffff;
}

/* Dark theme */
:root[data-theme="dark"] {
  --bg: #141a22;
  --surface: #1c242f;
  --text: #e6eaf0;
  --muted: #9aa5b4;
  --line: #2c3745;
  --accent: #7fb0e0;
  --accent-contrast: #101820;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.3rem;
  line-height: 1.65;
}

h1, h2 {
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); }
h2 { font-size: 1.6rem; }

p { max-width: none; margin: 0 0 1em; }

a { color: var(--accent); text-underline-offset: 0.2em; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- Layout ---------- */
.site-header,
main,
.site-footer {
  width: min(100% - 2 * var(--space), var(--page-width));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  gap: var(--space);
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-ui);
}

.brand {
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}
.brand:hover { color: var(--accent); text-decoration-color: currentColor; }

.site-header nav ul {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--text); }

.hero { padding-block: clamp(3rem, 12vw, 7rem); }
.lede {
  margin: 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--accent);
  font-size: 1.3rem;
  font-style: italic;
  color: var(--muted);
}
.lede p { margin: 0; max-width: none; }
.lede footer {
  margin-top: 0.75rem;
  text-align: right;
  font-family: var(--font-ui);
  font-size: 0.95rem;
}
.lede cite { font-style: normal; }



.section { padding-block: 1.5rem; border-top: 1px solid var(--line); }

.site-footer {
  padding-block: 2rem;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  border-top: 1px solid var(--line);
}

/* ---------- Components ---------- */
.button {
  display: inline-block;
  padding: 0.6em 1.2em;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-weight: 600;
  text-decoration: none;
}
.button:hover { filter: brightness(1.08); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--surface); }

.icon {
  width: 1.3rem;
  height: 1.3rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Show the icon for the mode you'd switch TO */
:root[data-theme="light"] .icon-sun,
:root[data-theme="dark"]  .icon-moon { display: none; }

@media (prefers-reduced-motion: no-preference) {
  body, .theme-toggle, .button { transition: background-color 0.2s, color 0.2s, border-color 0.2s; }
}

/* ---------- Project list (homepage) ---------- */
.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
}
.project { padding-block: 1.5rem; border-top: 1px solid var(--line); }
.project:first-child { border-top: 0; padding-top: 0; }
.project h2 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 0.25em; }
.project h2 a { color: var(--text); text-decoration-color: var(--line); }
.project h2 a:hover { color: var(--accent); text-decoration-color: currentColor; }
.project-meta {
  margin: 0 0 0.5em;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.9rem;
}
.project p:last-child { 
  margin-bottom: 0;
}

/* ---------- Prose and figures (reuse on project pages later) ---------- */
.prose p { hyphens: auto; }
.prose h1 {
  margin-top: 1.25em;
  margin-bottom: 0;
}
.prose h2, .prose h3 { margin-top: 2em; }
.prose blockquote {
  margin: 1.5em 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--line);
  color: var(--muted);
}

figure { margin: 2rem 0; }
figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 2px;
}
figcaption {
  margin-top: 0.6rem;
  max-width: var(--measure);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  line-height: 1.5;
}
/* Optional: let an image run wider than the text column */
figure.wide { width: none; }

/* Slightly dim photos in dark mode so they don't glare */
:root[data-theme="dark"] figure img { filter: brightness(0.9); }
