/* ==========================================================================
   ajwarnke.com — one stylesheet for every page
   ========================================================================== */

/* Fonts are self-hosted (see /fonts) so the site works offline and loads
   nothing from third parties. Both are licensed under the SIL OFL. */
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-latin-opsz-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-latin-opsz-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---- Colors ------------------------------------------------------------ */
:root {
  --bg: #f7f5f0;
  --text: #1d1c18;
  --soft: #4a4840;        /* secondary body text */
  --muted: #8f8a7c;       /* labels, dates */
  --rule: #e2ded3;        /* dividers */
  --underline: #c8c2b2;   /* link underlines */
  --selection: #e9e2cf;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  color-scheme: light;
}


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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.7;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--selection); }

.page {
  max-width: 620px;
  margin: 0 auto;
  padding: 9vh 24px 12vh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

p { margin: 0 0 1.1em; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.15s ease;
}
a:hover { text-decoration-color: currentColor; }

strong { font-weight: 600; }

/* ---- Secondary text: header, footer, link line, dates ----------------- */
.site-header,
.site-footer,
.links-line,
.date {
  font-family: var(--serif);
  font-size: 0.9em;
  line-height: 1.6;
  color: var(--soft);
}
.date { font-style: italic; color: var(--muted); }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 3.5rem;
}
.site-header a { text-decoration: none; color: var(--soft); }
.site-header a:hover { color: var(--text); }
.site-header nav { display: flex; gap: 20px; }
.site-header a[aria-current="page"] { color: var(--text); }

/* About / Writing tabs */
.tabs a {
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.tabs a[aria-current="page"] { border-bottom-color: currentColor; }

.site-footer {
  margin-top: 4.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
}
.site-footer a { color: var(--soft); }
.site-footer a:hover { color: var(--text); }

/* ---- Homepage ---------------------------------------------------------- */
.home-header { margin-bottom: 2.5rem; }

.name {
  font-size: 2em;
  line-height: 1.15;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0 0 0.45rem;
}

.links-line a { color: var(--soft); }
.links-line a:hover { color: var(--text); }
.sep { color: var(--muted); margin: 0 0.35em; }

/* "(soon)" tag next to Writing */
.soon { font-style: italic; color: var(--muted); }

section { margin-top: 2.75rem; }
main > section:first-child { margin-top: 0; }

/* Section headings, academic style: serif, sentence case, set in the text color */
section h2 {
  font-size: 1.15em;
  line-height: 1.3;
  font-weight: 600;
  margin: 0 0 0.7rem;
}

.soft { color: var(--soft); }

/* Preview card on the Writing page, with an optional image */
.post {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 0;
}
.post-title {
  font-size: 1.1em;
  font-weight: 500;
  line-height: 1.35;
  margin: 0;
}
.post-meta {
  margin: 0.15em 0 0;
  color: var(--soft);
  font-style: italic;
}
.cover {
  margin: 0;
  flex: 0 0 220px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--rule);
}
.cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
cite { font-style: italic; }

/* Numbered notes */
.notes {
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.8em;
  line-height: 1.6;
  color: var(--soft);
}
.notes h2 { color: var(--text); font-size: 1.44em; }
.notes ol { margin: 0; padding-left: 1.3em; }
.notes li { margin-bottom: 0.5em; padding-left: 0.2em; }
.notes li::marker { color: var(--muted); }
.notes a[href^="#"] { text-decoration: none; color: var(--muted); }
:target { background: var(--selection); }

/* ---- Writing index ----------------------------------------------------- */
.page-title {
  font-size: 2.1em;
  line-height: 1.2;
  font-weight: 400;
  margin: 0 0 0.6em;
  letter-spacing: -0.01em;
}

.essay-list {
  list-style: none;
  margin: 2.25rem 0 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}
.essay-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
}
.essay-list a { text-decoration: none; }
.essay-list a:hover { text-decoration: underline; text-decoration-color: var(--underline); }
.essay-list .date { white-space: nowrap; flex-shrink: 0; }

.empty {
  color: var(--muted);
  font-style: italic;
}

/* ---- Essay ------------------------------------------------------------- */
.essay-header { margin-bottom: 2.5rem; }
.essay-header .page-title { margin-bottom: 0.35em; }

.essay p { margin-bottom: 1.25em; }

.essay h2 {
  font-size: 1.25em;
  font-weight: 500;
  line-height: 1.35;
  margin: 2.2em 0 0.7em;
}

.essay blockquote {
  margin: 1.6em 0;
  padding-left: 1.2em;
  border-left: 2px solid var(--rule);
  color: var(--soft);
  font-style: italic;
}

.essay ul,
.essay ol { padding-left: 1.3em; margin: 0 0 1.25em; }
.essay li { margin-bottom: 0.4em; }

.essay hr {
  border: 0;
  margin: 2.5em 0;
  text-align: center;
}
.essay hr::after {
  content: "* * *";
  color: var(--muted);
  letter-spacing: 0.6em;
}

.essay img { max-width: 100%; height: auto; }

.essay code {
  font-family: var(--mono);
  font-size: 0.8em;
}

.footnotes {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85em;
  color: var(--soft);
}
.footnotes ol { padding-left: 1.2em; }
sup { font-size: 0.7em; line-height: 0; }
sup a { text-decoration: none; }

/* ---- Small screens ----------------------------------------------------- */
@media (max-width: 560px) {
  body { font-size: 18px; }
  .page { padding: 40px 20px 64px; }
  .site-header { margin-bottom: 2.5rem; }
  .page-title { font-size: 1.8em; }
  .essay-list li { flex-direction: column; gap: 2px; }
  .post { flex-direction: column; align-items: stretch; gap: 12px; }
  .cover { flex-basis: auto; width: 100%; }
}
