:root {
  --paper: #fffefb;
  --ink: #111;
  --ink-muted: #6b6b6b;
  --rule: #d8d5cd;
  --measure: 36rem;
  --sig-invert: 0;
  --sig-opacity: 1;
  --mark-bg: #fbf0a4;
  --callout-bg: rgba(0, 0, 0, 0.028);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12110f;
    --ink: #c7c3b9;
    --ink-muted: #8a857c;
    --rule: #2e2b26;
    --sig-invert: 1;
    /* The signature inverts to pure white, which would then be the brightest
       thing on the page; hold it back to sit with the body text. */
    --sig-opacity: 0.8;
    --mark-bg: #54481c;
    --callout-bg: rgba(255, 255, 255, 0.045);
  }
}

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

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

body {
  margin: 0;
  padding: 0 1.5rem 4rem;
  background: var(--paper);
  color: var(--ink);
  font-family: "Times New Roman", Times, serif;
  font-size: 19px;
  line-height: 1.65;
}

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: from-font;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* ---------- masthead ---------- */

.masthead {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3.5rem 0 0;
  text-align: center;
}

.signature {
  display: inline-block;
  text-decoration: none;
  line-height: 0;
}

.signature img {
  width: 200px;
  height: auto;
  filter: invert(var(--sig-invert));
  opacity: var(--sig-opacity);
}

.nav {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
  gap: 1.75rem;
  font-weight: 700;
  font-size: 1.05rem;
}

.nav a {
  text-decoration: none;
}

.nav a:hover,
.nav a.current {
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 2px;
}

/* ---------- content ---------- */

.content {
  max-width: var(--measure);
  margin: 0 auto;
  padding-top: 3rem;
}

.content > :first-child {
  margin-top: 0;
}

p,
ul,
ol,
blockquote,
pre,
table {
  margin: 0 0 1.2em;
}

h1,
h2,
h3 {
  font-weight: 700;
  line-height: 1.25;
  margin: 2em 0 0.6em;
}

h1 {
  font-size: 1.7rem;
}

h2 {
  font-size: 1.3rem;
}

h3 {
  font-size: 1.1rem;
}

ul,
ol {
  padding-left: 1.3em;
}

li {
  margin-bottom: 0.35em;
}

blockquote {
  margin-left: 0;
  padding-left: 1.1em;
  border-left: 2px solid var(--rule);
  color: var(--ink-muted);
  font-style: italic;
}

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

img,
video {
  max-width: 100%;
  height: auto;
}

code,
pre {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
}

pre {
  padding: 0.9em 1em;
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow-x: auto;
}

pre code {
  font-size: inherit;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.4em 0.6em 0.4em 0;
  border-bottom: 1px solid var(--rule);
}

/* ---------- post list ---------- */

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0 1rem;
  align-items: baseline;
  padding: 0.55em 0;
  border-bottom: 1px solid var(--rule);
  margin: 0;
}

.post-list time {
  color: var(--ink-muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.post-list li:last-child {
  border-bottom: none;
}

.post-list a {
  text-decoration: none;
}

.post-list a:hover {
  text-decoration: underline;
}

@media (max-width: 30rem) {
  .post-list li {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
}

/* ---------- single post ---------- */

.post img {
  display: block;
  margin: 0 0 1.2em;
}

/* Full posts on the home page, separated by a rule. */
.home-post + .home-post {
  margin-top: 3em;
  padding-top: 3em;
  border-top: 1px solid var(--rule);
}

.home-post .post-title {
  font-size: 1.45rem;
}

.home-post .post-title a {
  text-decoration: none;
}

.home-post .post-title a:hover {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.home-post .post-date {
  margin-bottom: 1.6em;
}

.post-title {
  margin-top: 0;
  margin-bottom: 0.15em;
}

.post-date {
  color: var(--ink-muted);
  font-size: 0.9rem;
  margin-bottom: 2.2em;
}

.back {
  max-width: var(--measure);
  margin: 3rem auto 0;
  font-size: 0.95rem;
}

.back a {
  text-decoration: none;
  color: var(--ink-muted);
}

.back a:hover {
  text-decoration: underline;
}

/* ---------- Obsidian syntax ---------- */

mark {
  background: var(--mark-bg);
  color: inherit;
  padding: 0.05em 0.15em;
}

/* Callouts keep their title text in the normal ink colour — only the rule and
   the icon carry the accent, so contrast holds in both themes. */
.callout {
  --callout-accent: var(--ink-muted);
  margin: 0 0 1.2em;
  padding: 0.8em 1em;
  border-left: 3px solid var(--callout-accent);
  border-radius: 0 3px 3px 0;
  background: var(--callout-bg);
}

.callout[data-callout="note"],
.callout[data-callout="info"],
.callout[data-callout="todo"] {
  --callout-accent: #4a72a8;
}

.callout[data-callout="tip"],
.callout[data-callout="hint"],
.callout[data-callout="success"],
.callout[data-callout="check"],
.callout[data-callout="done"] {
  --callout-accent: #4b8457;
}

.callout[data-callout="warning"],
.callout[data-callout="caution"],
.callout[data-callout="attention"] {
  --callout-accent: #a8792c;
}

.callout[data-callout="danger"],
.callout[data-callout="error"],
.callout[data-callout="bug"],
.callout[data-callout="failure"] {
  --callout-accent: #a84c46;
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 0.45em;
  font-weight: 700;
}

.callout-title-icon {
  display: flex;
  color: var(--callout-accent);
}

.callout-title-icon svg {
  width: 1em;
  height: 1em;
}

.callout-content {
  margin-top: 0.4em;
}

.callout-content > :last-child {
  margin-bottom: 0;
}

ul.contains-task-list {
  list-style: none;
  padding-left: 0.15em;
}

.task-list-item label {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5em;
}

.task-list-item-checkbox {
  margin: 0;
}

.footnotes-sep {
  margin-top: 3em;
}

.footnotes {
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.footnote-backref {
  text-decoration: none;
}

/* ---------- footer ---------- */

.footer {
  max-width: var(--measure);
  margin: 4rem auto 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.footer p {
  margin: 0;
}

.footer a {
  color: inherit;
}
