:root {
  color-scheme: light dark;
  --paper: light-dark(#f3ecd9, #101621);
  --wash: light-dark(#fbf6e9, #20304b);
  --ink: light-dark(#302820, #c8d0df);
  --heading: light-dark(#231d16, #dde4ee);
  --muted: light-dark(#615345, #a4b0c4);
  --accent: light-dark(#823523, #b5cdee);
  --rule: light-dark(#9f8e74, #58657e);
  --panel: light-dark(#e8deca, #1a2435);
  --paper-grain: light-dark(#6c50200b, transparent);
  --stars: light-dark(transparent, #c9dcf599);
  --small-stars: light-dark(transparent, #a9c3e16b);
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, sans-serif;
  font: 100%/1.7 var(--serif);
  color: var(--ink);
  background-color: var(--paper);
}

:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='dark'] { color-scheme: dark; }

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

body {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background:
    radial-gradient(ellipse at 45% 0, var(--wash), transparent 44rem) no-repeat,
    var(--paper);
}

body::before, .home::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

body::before {
  background: radial-gradient(circle, var(--paper-grain) .58px, transparent .9px) 0 0 / 5px 7px;
}

/* Different tile sizes and positions keep the tiny stars from forming a grid. */
.home::after {
  bottom: auto;
  height: 50%;
  background:
    radial-gradient(circle at 16px 22px, var(--stars) .65px, transparent 1.2px) 0 0 / 113px 103px,
    radial-gradient(circle at 86px 49px, var(--small-stars) .55px, transparent 1.05px) 0 0 / 102px 77px,
    radial-gradient(circle at 48px 73px, var(--small-stars) .6px, transparent 1.1px) 0 0 / 79px 117px,
    radial-gradient(circle at 32px 38px, var(--stars) .65px, transparent 1.15px) 0 0 / 131px 137px,
    radial-gradient(circle at 12px 59px, var(--small-stars) .55px, transparent 1.05px) 0 0 / 83px 71px,
    radial-gradient(circle at 71px 12px, var(--small-stars) .65px, transparent 1.15px) 0 0 / 107px 97px,
    radial-gradient(circle at 45px 19px, var(--small-stars) .55px, transparent 1.05px) 0 0 / 67px 121px;
  mask-image: linear-gradient(to bottom, #000, #0009 38%, transparent);
}

a { color: var(--accent); text-underline-offset: .2em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.frame { width: min(100% - 2.5rem, 43rem); margin-inline: auto; }

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .45rem 1rem;
  padding-block: .8rem;
  border-bottom: 3px double var(--rule);
}

.wordmark {
  color: var(--heading);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .85rem;
  font: .875rem/1.2 var(--sans);
}

.theme-toggle {
  min-height: 2.25rem;
  padding: .35rem .55rem;
  border: 1px solid var(--rule);
  border-radius: .2rem;
  color: var(--ink);
  background: var(--panel);
  font: inherit;
  cursor: pointer;
}

.theme-toggle::before {
  display: inline-block;
  width: .7em;
  height: .7em;
  margin-inline-end: .45em;
  border: 1px solid currentColor;
  border-radius: 50%;
  content: '';
}

.theme-toggle[aria-pressed='true']::before { background: currentColor; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

main { flex: 1; padding-block: 1.5rem 3rem; }

.page-title, .post-header h1, .post-header h2 {
  margin: 0;
  color: var(--heading);
  font: 700 1.375rem/1.25 var(--serif);
  overflow-wrap: anywhere;
}

.post-header { margin-block-end: .75rem; }
.post-header time { display: block; margin-block-end: .15rem; }
.intro { margin-block-start: .75rem; }
.intro + .feed { margin-block-start: 1.5rem; }

.feed-post + .feed-post {
  margin-block-start: 1.75rem;
  padding-block-start: 1.75rem;
  border-top: 1px solid var(--rule);
}

.prose { font-size: 1.125rem; overflow-wrap: anywhere; }
.prose > :first-child { margin-block-start: 0; }
.prose > :last-child { margin-block-end: 0; }
.prose p, .prose ul, .prose ol { margin-block: .8em; }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  color: var(--heading);
  font-size: 1.06em;
  line-height: 1.35;
}
.prose img { max-width: 100%; height: auto; }
.prose blockquote {
  margin-inline: 0;
  padding-inline-start: 1em;
  border-inline-start: 2px solid var(--rule);
  color: var(--muted);
}
.prose pre, .prose table { max-width: 100%; overflow: auto; }
.prose pre { padding: .85rem; background: var(--panel); }
.prose table { display: block; border-collapse: collapse; }
.prose th, .prose td { padding: .3em .55em; border: 1px solid var(--rule); }

.archive { margin-block-start: 1rem; }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .25rem 1rem;
  align-items: baseline;
  padding-block: .75rem;
  border-top: 1px solid var(--rule);
}
.post-list li > a { font-weight: 700; overflow-wrap: anywhere; }
.post-list li > p { grid-column: 1 / -1; margin: 0; }

time, .empty, .site-footer { color: var(--muted); font: .875rem/1.5 var(--sans); }
.empty { margin: 0; }
.site-footer { padding-block: .85rem 1.25rem; border-top: 1px solid var(--rule); }

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

@media (forced-colors: active) {
  body::before, .home::after { display: none; }
}
