/* jenf.vercel.app
   Type from jenniferfang.com: Big Caslon for display, Space Grotesk for reading.
   One blue, International Klein #002FA7, on white. Everything else is ink on paper.
   No monospace outside code. Nothing uppercased. Nothing greyed to recede. */

:root {
  --serif: "Big Caslon", "Libre Caslon Text", "Iowan Old Style", Georgia, serif;
  --serif-italic: "Libre Caslon Text", "Big Caslon", Georgia, serif;
  --sans: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --code: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --paper: #fbfaf7;
  --ink: #121212;
  --accent: #002fa7;          /* International Klein Blue */
  --on-accent: #ffffff;
  --link: #002fa7;            /* link text, and the hairlines blue draws */
  --link-weight: 400;
  --rule: rgba(18, 18, 18, 0.14);
  --code-bg: rgba(18, 18, 18, 0.05);

  --measure: 36rem;

  /* Editable tokens. ui-agent writes these declarations back from the dev panel,
     so they stay literal values (no var() aliases) in px, rem or ms. */
  --space-row: 8px;
  --space-section: 48px;
  --space-page: 80px;
  --space-code: 16px;
  --radius-code: 2px;
  --radius-link: 1px;
  --motion-hover: 120ms;
  --type-body: 17px;
  --type-small: 14px;
}

/* Dark is the charcoal from jenniferfang.com, lightened enough to read a page of
   text on. Klein blue stays Klein blue here, but it cannot be the link color:
   #002FA7 on this charcoal is 1.5:1, which is a link nobody can read. So the
   dark page goes monochrome, links carry a little weight instead of a color,
   and the blue comes back the moment you touch one. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #232326;
    --ink: #f4f3ef;
    --accent: #002fa7;
    --on-accent: #ffffff;
    --link: #f4f3ef;
    --link-weight: 500;
    --rule: rgba(255, 255, 255, 0.2);
    --code-bg: rgba(255, 255, 255, 0.07);
  }
}

:root[data-theme="dark"] {
  --paper: #232326;
  --ink: #f4f3ef;
  --accent: #002fa7;
  --on-accent: #ffffff;
  --link: #f4f3ef;
  --link-weight: 500;
  --rule: rgba(255, 255, 255, 0.2);
  --code-bg: rgba(255, 255, 255, 0.07);
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--type-body);
  line-height: 1.55;
  font-feature-settings: "tnum" 1;
}

::selection { background: var(--accent); color: var(--on-accent); }

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--space-page) 1rem 4rem;
}
@media (max-width: 768px) {
  main { padding: 3rem 1.25rem 3rem; }
}

h1, h2, h3 { font-weight: 400; margin: 0; }

h1 {
  font-family: var(--serif);
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

h2 {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.2;
  margin-top: var(--space-section);
  margin-bottom: 0.75rem;
}

h3 {
  font-size: var(--type-body);
  font-weight: 500;
  margin-top: 2rem;
  margin-bottom: 0.4rem;
}

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

em, i { font-family: var(--serif-italic); font-style: italic; }
strong, b { font-weight: 500; }

a {
  color: var(--link);
  font-weight: var(--link-weight);
  text-decoration: none;
  transition: color var(--motion-hover) ease, background-color var(--motion-hover) ease,
    box-shadow var(--motion-hover) ease;
}
a:hover {
  color: var(--on-accent);
  background: var(--accent);
  text-decoration: none;
  box-shadow: 0 0 0 3px var(--accent);
  border-radius: var(--radius-link);
}
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Masthead */
.masthead { margin-bottom: 1.75rem; }
.dateline {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--serif-italic);
  font-style: italic;
  font-size: var(--type-small);
}

.crumb { display: inline-block; margin-bottom: 2.25rem; font-size: var(--type-small); }

/* The one place the blue carries weight: the line under a field-note title. */
.standfirst {
  margin: 0 0 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--link);
}
.standfirst p { margin-bottom: 0.5em; }
.standfirst p:last-child { margin-bottom: 0; }
.meta { font-size: var(--type-small); }
.meta a + a { margin-left: 0.75rem; }

/* Project list */
.projects { list-style: none; margin: 0; padding: 0; }
.projects li {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 1.5rem;
  row-gap: 0.15rem;
  padding: var(--space-row) 0 1rem;
  border-top: 1px solid var(--rule);
}
.projects li:last-child { border-bottom: 1px solid var(--rule); }
.projects .title, .projects .title a { font-weight: 500; }
.projects .when { font-size: var(--type-small); white-space: nowrap; padding-top: 0.2em; }
.projects .blurb { grid-column: 1 / -1; margin: 0.15rem 0 0; }
.projects .blurb a { white-space: nowrap; }

/* An unfinished thing says so in words, in the accent, without a badge. */
.wip {
  font-family: var(--serif-italic);
  font-style: italic;
  font-size: var(--type-small);
  color: var(--link);
  margin-left: 0.4em;
}

@media (max-width: 480px) {
  .projects li { grid-template-columns: 1fr; }
  .projects .when { padding-top: 0; }
}

/* Long-form */
article ul, article ol { padding-left: 1.15rem; margin: 0 0 1.1em; }
article li { margin-bottom: 0.4em; }

pre, code { font-family: var(--code); font-size: var(--type-small); }
code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: var(--radius-code); }
pre {
  background: var(--code-bg);
  padding: var(--space-code) 1.1rem;
  border-radius: var(--radius-code);
  overflow-x: auto;
  line-height: 1.5;
  margin: 1.25rem 0;
}
pre code { background: none; padding: 0; font-size: 1em; }

blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--link);
  font-family: var(--serif-italic);
  font-style: italic;
}

.scroll { overflow-x: auto; margin: 1.25rem 0; }
table { border-collapse: collapse; width: 100%; font-size: var(--type-small); }
th, td {
  text-align: left;
  padding: 0.45rem 1rem 0.45rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
th { font-weight: 500; }
td.num, th.num { text-align: right; padding-right: 0; }

footer {
  max-width: var(--measure);
  margin: var(--space-section) auto 0;
  padding: 1.5rem 1rem 3rem;
  border-top: 1px solid var(--rule);
  font-size: var(--type-small);
}
@media (max-width: 768px) { footer { padding: 1.5rem 1.25rem 3rem; } }
footer p { margin: 0; }

/* Theme toggle. Text, not an icon, because the rest of the site is words. */
#theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10;
  font: inherit;
  font-size: var(--type-small);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-link);
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  transition: color var(--motion-hover) ease, background-color var(--motion-hover) ease,
    border-color var(--motion-hover) ease;
}
#theme-toggle:hover { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
#theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 480px) { #theme-toggle { top: 0.75rem; right: 0.75rem; } }

/* The one icon on the site: a pin before the place I am. */
.pin { white-space: nowrap; }
.pin svg { display: inline-block; vertical-align: -1px; margin-right: 0.25em; color: var(--link); }
