/* aaron-marks.com
   The surface is plain. Everything below is hand-feel. */

/* Newsreader, by Production Type. Variable in weight and optical size,
   so the same file sets the small caption and the large title with
   different drawings. License in fonts/OFL.txt. */
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #fcfcfa;
  --ink: #1e1d1a;
  --ink-soft: #6b675f;
  --ink-faint: #b3aea4;
  --rule: #e6e2d8;
  --link: #2f4b6e;
  --link-visited: #6a4f6e;
  --selection: #e9e2cf;
  --measure: 36rem;
  --tempo: 220ms;
}

/* The page follows the sun where you are. site.js sets data-light. */
:root[data-light="dawn"]    { --paper: #f9f8f5; --ink: #24221e; }
:root[data-light="day"]     { --paper: #fcfcfa; --ink: #1e1d1a; }
:root[data-light="evening"] { --paper: #f8f4ec; --ink: #292520; --rule: #e6dfd0; --selection: #ecdfc4; }
:root[data-light="night"]   {
  --paper: #1a1916; --ink: #d8d2c6; --ink-soft: #8f897c; --ink-faint: #514d45;
  --rule: #2c2a25; --link: #a9bdd6; --link-visited: #c2aec6; --selection: #3a3629;
}

html { background: var(--paper); transition: background var(--tempo) ease; }

body {
  max-width: var(--measure);
  margin: 4rem auto 6rem;
  padding: 0 1.25rem;
  font-family: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 1.125rem;
  line-height: 1.55;
  font-optical-sizing: auto;
  color: var(--ink);
  background: var(--paper);
  transition: color var(--tempo) ease, background var(--tempo) ease;
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
}

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

h1 {
  font-size: 1.5rem;
  font-weight: normal;
  letter-spacing: -0.005em;
  margin: 0 0 0.25rem;
}
h2 { font-size: 1.125rem; font-weight: normal; margin: 2.5rem 0 0.5rem; }
p { margin: 0 0 1.1rem; }
p + p { text-indent: 0; }

.tagline { color: var(--ink-soft); margin-bottom: 0.6rem; }
.date, .meta { color: var(--ink-soft); font-size: 0.9rem; font-variant-numeric: oldstyle-nums; }

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.16em;
  text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent);
  transition: text-decoration-color var(--tempo) ease, color var(--tempo) ease;
}
a:hover { text-decoration-color: var(--link); }
a:visited { color: var(--link-visited); }
a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--link);
  border-radius: 2px;
}

.links { margin-bottom: 2rem; }
.links a { margin-right: 0.35rem; }
.links span { color: var(--ink-faint); margin-right: 0.35rem; }

ul.essays { list-style: none; padding: 0; margin: 0; }
ul.essays li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.45rem 0; border-top: 1px solid var(--rule);
}
ul.essays li:last-child { border-bottom: 1px solid var(--rule); }
ul.essays a { text-decoration: none; }
ul.essays a:hover { text-decoration: underline; }
ul.essays li:hover { cursor: e-resize; }

ul.threads, ul.quotes, ul.classes { list-style: none; padding: 0; margin: 0; }
ul.threads li, ul.quotes li, ul.classes li { padding: 0.45rem 0; border-top: 1px solid var(--rule); }
ul.threads li:last-child, ul.quotes li:last-child, ul.classes li:last-child { border-bottom: 1px solid var(--rule); }
ul.quotes li { font-style: italic; }
.who { display: block; font-style: normal; font-size: 0.9rem; color: var(--ink-soft); font-variant-numeric: oldstyle-nums; }

/* Sidenotes. Wide screens: margin. Narrow: tap to unfold. Pure CSS. */
.sn-ref { cursor: pointer; }
.sn-ref sup { font-size: 0.7em; color: var(--link); padding-left: 0.05em; }
.sn-toggle { display: none; }
.sidenote {
  float: right; clear: right;
  width: 14rem; margin-right: -17rem; margin-top: 0.15rem;
  font-size: 0.85rem; line-height: 1.45; color: var(--ink-soft);
}
.sidenote::before { content: counter(sidenote) " "; counter-increment: sidenote; color: var(--link); }
.sn-ref sup::before { content: counter(sidenote-ref); counter-increment: sidenote-ref; }
body { counter-reset: sidenote sidenote-ref; }
@media (max-width: 72rem) {
  .sidenote { display: none; float: none; width: auto; margin: 0.4rem 0 0.9rem 1rem; padding-left: 0.6rem; border-left: 1px solid var(--rule); }
  .sn-toggle:checked + .sidenote { display: block; }
}

/* Where you left off. */
.bookmark { position: relative; }
.bookmark::before {
  content: ""; position: absolute; left: -1.25rem; top: 0.55em;
  width: 0.5rem; height: 1px; background: var(--ink-faint);
}

.back { margin-top: 3.5rem; font-size: 0.9rem; }
.back a { text-decoration: none; color: var(--ink-soft); }
.back a:hover { color: var(--link); }

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

footer { margin-top: 5rem; font-size: 0.82rem; color: var(--ink-soft); }
footer a { color: inherit; }
footer span { color: var(--ink-faint); margin: 0 0.35rem; }

/* 404 */
.lost h1 { font-size: 3.5rem; letter-spacing: -0.02em; line-height: 1; margin-bottom: 1.5rem; }
.lost p { max-width: 28rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Print. The one place the site is allowed to be a book. */
@media print {
  @page { margin: 2.2cm 2.4cm; @top-center { content: "aaron-marks.com"; font-size: 8pt; color: #777; } @bottom-center { content: counter(page); font-size: 9pt; } }
  html, body { background: #fff; color: #000; }
  body { max-width: none; margin: 0; padding: 0; font-size: 11pt; line-height: 1.5; }
  p { orphans: 3; widows: 3; }
  h1, h2 { page-break-after: avoid; }
  a { color: #000; text-decoration: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8.5pt; color: #555; }
  .sidenote { display: block; float: none; width: auto; margin: 0.3rem 0 0.8rem 1.2rem; font-size: 9pt; }
  .links, .back, footer, .bookmark::before { display: none; }
}
