/* Deliberately plain: think 1997 homepage. */
body { font-family: "Times New Roman", Times, serif; max-width: 640px; margin: 2em auto; padding: 0 16px; line-height: 1.5; color: #000; background: #fff; }
a, a:visited { color: #000; }
h1 { font-size: 1.6em; margin-bottom: .2em; }
ul.plain { list-style: none; padding: 0; margin: 0 0 1em; }
ul.plain li { margin: .3em 0; }
.nav { margin-bottom: 2em; }
.meta { color: #555; font-size: .9em; }
.draft { color: #a00; font-size: .85em; }
article img { max-width: 100%; height: auto !important; }
footer { margin-top: 3em; font-size: .85em; color: #555; }

/* Footnotes: plain [1] markers. The full notes are always listed at the bottom.
   On wide screens a short copy also sits in the right margin beside the line;
   hover the marker or the note to read all of it there. */
a.footnote-ref { text-decoration: none; }
a.footnote-ref sup, .sidenote sup { font-size: .7em; }
.footnotes { font-size: .9em; }
.footnotes hr { display: none; }
.sidenote { display: none; }
.footnotes, .sidenote { overflow-wrap: anywhere; } /* long bare links wrap instead of widening the page */
#refs { font-size: .9em; }
html { scroll-behavior: smooth; }
h2[id], h3[id] { scroll-margin-top: 1em; }

/* Sections list on the left (wide screens only) */
.toc { display: none; }

@media (min-width: 1000px) {
  body.post { margin-left: calc(50% - 460px); }
  .sidenote { display: block; float: right; clear: right; width: 240px; margin-right: -280px;
              font-size: .85em; line-height: 1.35; color: #333; margin-top: .2em; margin-bottom: .8em;
              padding: 2px 4px; }
  /* long notes are cut to six lines in the margin */
  .sidenote { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; line-clamp: 6; overflow: hidden; }
  .sidenote:hover, a.footnote-ref:hover + .sidenote { display: block; -webkit-line-clamp: unset; line-clamp: unset; background: #fff3b0; }
}
@media (min-width: 1240px) {
  body.post { margin-left: calc(50% - 340px); }
  .toc { display: block; position: fixed; top: 7em; left: calc(50% - 560px); width: 190px;
         font-size: .85em; line-height: 1.35; max-height: calc(100vh - 9em); overflow-y: auto; }
  .toc ul { list-style: none; padding: 0; margin: 0; }
  .toc li { margin-bottom: .5em; }
  .toc .toc-h3 { padding-left: 1em; }
  .toc a { color: #555; text-decoration: none; }
  .toc a:hover { color: #000; text-decoration: underline; }
}
object.pdf { width: 100%; height: 85vh; border: 1px solid #ccc; }

/* Glossary terms: ordinary text; hovering (or tapping the underlined first use) shows the definition */
.gloss { position: relative; }
.gloss-first { border-bottom: 1px dotted #777; cursor: help; outline: none; }
.gloss:hover::after, .gloss:focus::after {
  content: attr(data-def); position: absolute; left: 0; top: 1.5em; z-index: 5;
  width: 280px; max-width: 70vw; padding: 6px 8px; background: #fff; color: #000;
  border: 1px solid #777; font-size: .85rem; line-height: 1.35; font-weight: normal;
  white-space: normal; text-align: left; }
.sidenote .gloss { border-bottom: 0; cursor: auto; }
.sidenote .gloss:hover::after, .sidenote .gloss:focus::after { content: none; }
