/* Mackenzie Dion — one stylesheet for every page.
   Palette: white background, black text, grey for dates and notes. */

:root {
  --paper: #ffffff;
  --ink: #000000;          /* body text */
  --ink-strong: #000000;   /* site name, post titles */
  --ink-muted: #6b6b6b;    /* dates, captions, notes */
  --rule: #e8e8e8;         /* hairlines */
  --wash: #f6f6f6;         /* quote and figure backgrounds */
  --link-line: rgba(0, 0, 0, 0.35);

  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --measure: 38rem;        /* ~65 characters */
  --text: 1.0625rem;       /* 17px body */
  --small: 0.875rem;
  --leading: 1.65;
  --gutter: max(20px, env(safe-area-inset-left, 0px));
  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text);
  line-height: var(--leading);
  font-feature-settings: "ss01" on;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- header ---------- */
.site-header {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.75rem var(--gutter) 0;
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}
.site-name {
  color: var(--ink-strong);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.site-nav { display: flex; gap: 1.5rem; font-size: 0.9375rem; }
.site-nav a { color: var(--ink-strong); text-decoration: none; }
.site-nav a:hover { text-decoration: underline; text-underline-offset: 0.25em; }
.site-nav a[aria-current="page"] { font-weight: 600; }

/* ---------- main column ---------- */
main {
  max-width: calc(var(--measure) + 40px);
  margin: 0 auto;
  padding: 4.5rem var(--gutter) 6rem;
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

/* ---------- type ---------- */
h1, h2, h3 { color: var(--ink-strong); text-wrap: balance; }

h1 {
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0;
}
h2 {
  font-size: 1.1875rem;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 2.75rem 0 0.75rem;
}
h3 {
  font-size: var(--text);
  line-height: 1.4;
  font-weight: 600;
  margin: 2rem 0 0.5rem;
}

p { margin: 0 0 1.1em; }
b, strong { font-weight: 600; color: var(--ink-strong); }
sup { font-size: 0.7em; line-height: 0; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--link-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
}
a:hover { text-decoration-color: currentColor; }
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 2px; }

ul, ol { margin: 0 0 1.25em; padding-left: 1.35em; }
li { margin: 0.35em 0; padding-left: 0.15em; }
li > ul, li > ol { margin: 0.35em 0 0.5em; }
li::marker { color: var(--ink-muted); }

blockquote {
  margin: 1.5em 0;
  padding: 0.25em 0 0.25em 1.25em;
  border-left: 2px solid var(--rule);
  color: var(--ink);
}
blockquote p:last-child { margin-bottom: 0; }
li blockquote { margin: 0.75em 0 0.25em; font-size: 0.95em; }

figure { margin: 2rem 0; }
figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  background: var(--wash);
}
figcaption { margin-top: 0.6rem; font-size: var(--small); color: var(--ink-muted); }

hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0; }

/* ---------- post page ---------- */
.post-header { margin-bottom: 2.75rem; }
.post-date {
  display: block;
  margin-top: 0.85rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
}
.post-body > :first-child { margin-top: 0; }

.meta-note { color: var(--ink-muted); font-size: 0.9375rem; }
.thanks { margin-top: 2.5rem; color: var(--ink-muted); }
.credit { font-size: var(--small); color: var(--ink-muted); }
.equation {
  font-family: var(--mono);
  font-size: 0.95em;
  padding: 0.75rem 1rem;
  background: var(--wash);
  border-radius: 4px;
  overflow-x: auto;
}

/* endnotes */
.notes-heading {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  font-size: var(--small);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}
ol.notes { font-size: 0.9375rem; color: var(--ink); }
ol.notes li { margin: 0.6em 0; }
.backref { text-decoration: none; margin-left: 0.25em; color: var(--ink-muted); }
.fnref a { text-decoration: none; padding: 0 0.1em; }
:target { scroll-margin-top: 1.5rem; }
li:target { background: var(--wash); border-radius: 3px; }

.post-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  font-size: var(--small);
  color: var(--ink-muted);
}

/* ---------- writing index ---------- */
.post-list { list-style: none; padding: 0; margin: 2rem 0 0; }
.post-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  margin: 0;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--rule);
}
.post-list li:first-child { border-top: 1px solid var(--rule); }
.post-list a { text-decoration: none; color: var(--ink-strong); min-width: 0; }
.post-list a:hover { text-decoration: underline; text-decoration-color: var(--link-line); }
.post-list time, .post-list .ext {
  flex: none;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink-muted);
  white-space: nowrap;
}
/* writing page matches the home page scale */
.writing-page h1 { font-size: var(--text); line-height: 1.4; letter-spacing: 0; }
.writing-page .post-list { margin-top: 0.75rem; }
.writing-page .post-list li { padding: 0.5rem 0; gap: 1rem; }
.writing-page .post-list a { color: var(--ink); }
.writing-page .post-list time, .writing-page .post-list .ext { font-size: 0.75rem; }
.writing-page .feedback { margin-top: 1.75rem; font-size: var(--text); }
.feedback { margin-top: 2.5rem; color: var(--ink-muted); font-size: 0.9375rem; }

/* ---------- home ---------- */
.home section + section { margin-top: 2.5rem; }
.home h2 { margin: 0 0 0.5rem; font-size: var(--text); }
.socials { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin-bottom: 0.4rem; }
.email { color: var(--ink-muted); }

@media (max-width: 480px) {
  main { padding-top: 3rem; }
  h1 { font-size: 1.65rem; }
  .post-list li { flex-direction: column; gap: 0.15rem; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
