/* Old-web theme: Source Sans + EB Garamond, blue links, plain rules, a few soft colours. Shared by every page. */

:root {
  --bg: #ffffff;
  --text: #000000;
  --muted: #555555;
  --link: #0000ee;
  --code-bg: #fafafa;
  --code-border: #ececec;
  --code-text: #1a1a1a;
  --code-comment: #6e6e6e;
  --border: #999999;
  --nav-bg: #eef3fb;
  --nav-border: #c9d6ec;
  --highlight: #fff1a8;

  --sans: 'Source Sans 3', Helvetica, Arial, sans-serif;
  --serif: 'EB Garamond', Georgia, 'Times New Roman', Times, serif; /* titles and headings */
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

html.dark-mode {
  color-scheme: dark;
  --bg: #111111;
  --text: #e6e6e6;
  --muted: #aaaaaa;
  --link: #8ab4ff;
  --code-bg: #1a1a1a;
  --code-border: #2a2a2a;
  --code-text: #e6e6e6;
  --code-comment: #9a9a9a;
  --border: #666666;
  --nav-bg: #18202e;
  --nav-border: #2c3a52;
  --highlight: #4d4417;
}

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

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

body {
  max-width: 38rem;
  margin: 0;
  padding: 12px 24px 32px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: break-word;
}

/* Top navigation bar */

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
  padding: 4px 10px;
  background: var(--nav-bg);
  border: 1px solid var(--nav-border);
  font-family: var(--sans);
  font-size: 13px;
}

.site-nav nav {
  line-height: 1.8;
}

.site-nav strong {
  font-weight: 600;
}

/* The dark mode toggle is a button dressed as a nav link */

.theme-toggle {
  appearance: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

hr {
  margin: 12px 0 16px;
}

/* Links: one colour in every state (no visited or active colour) */

a,
a:visited,
a:hover,
a:active {
  color: var(--link);
}

/* Breadcrumbs */

.breadcrumbs {
  margin: 0 0 8px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumbs li {
  margin: 0;
}

.breadcrumbs li + li::before {
  content: '>';
  margin: 0 0.45em;
}

/* Headings */

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.005em;
  color: var(--text);
}

h1 {
  margin: 0.35em 0 0.3em;
  font-size: 2.6em;
}

h2 {
  margin: 1.5em 0 0.35em;
  font-size: 1.7em;
}

h3 {
  margin: 1.4em 0 0.3em;
  font-size: 1.4em;
}

.meta {
  margin: 0 0 1em;
  color: var(--muted);
  font-style: italic;
}

/* Body text */

p {
  margin: 0 0 1em;
}

ul,
ol {
  margin: 0 0 1em;
  padding-left: 2em;
}

li {
  margin: 0.3em 0;
}

blockquote {
  margin: 1.2em 2em;
  font-style: italic;
}

.entry-name {
  font-weight: 600;
}

/* Code blocks: whitish with a light border */

pre {
  margin: 1.25em 0 1.5em;
  padding: 12px 16px;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  color: var(--code-text);
  font-size: 13px;
  line-height: 1.6;
  tab-size: 2;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) transparent;
}

code {
  font-family: var(--mono);
}

pre code {
  font-size: inherit;
}

:not(pre) > code {
  padding: 1px 4px;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  font-size: 0.9em;
}

pre .comment {
  color: var(--code-comment);
  font-style: italic;
}

.plate {
  margin: 0 0 1em;
}

.plate img {
  display: block;
  width: 200px;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--text);
}

/* Lists of pages and essays */

.toc li,
.essays li {
  margin: 0.5em 0;
}

.essays {
  padding-left: 0;
  list-style: none;
}

.essay-date {
  display: block;
  color: var(--muted);
  font-style: italic;
}

/* Previous / next */

.page-turn {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  font-family: var(--sans);
  font-size: 13px;
}

.page-turn .next {
  margin-left: auto;
}

.footer-note {
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 480px) {
  body {
    padding: 8px 16px 24px;
    font-size: 15px;
  }

  h1 {
    font-size: 2.2em;
  }
}

@media print {
  .theme-toggle,
  .page-turn {
    display: none;
  }
}
