@font-face {
  font-family: "Roboto Mono";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("/static/fonts/roboto-mono-latin-300-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Roboto Mono";
  font-style: italic;
  font-weight: 300;
  font-display: swap;
  src: url("/static/fonts/roboto-mono-latin-300-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Roboto Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/roboto-mono-latin-700-normal.woff2") format("woff2");
}

:root {
  --fg: #000;
  --bg: #fff;
  --accent: #0000ee;
  --muted: #888;
  --rule: #000;
  --soft: #f4f4f4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e8e8e8;
    --bg: #111;
    --accent: #6699ff;
    --muted: #888;
    --rule: #e8e8e8;
    --soft: #1c1c1c;
  }
  /* SVG project logos are usually drawn dark-on-transparent; give them a
     light backdrop so they stay readable on a dark page. */
  .header-row .page-logo { background: #fff; }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 300 14px/1.5 "Roboto Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  -webkit-font-smoothing: antialiased;
}

body {
  max-width: 900px;
  margin: 0;
  padding: 2ch 3ch 6ch;
}

a {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover { color: var(--accent); }

a.wikilink { text-decoration: underline; }
a.wikilink.broken {
  color: var(--muted);
  text-decoration: underline dashed var(--muted);
}

/* ---- HEADER & FOOTER ---- */

header.site, footer.site {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--rule);
  padding: 0.5ch 0;
  margin-bottom: 2ch;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
footer.site {
  border-top: 1px solid var(--rule);
  border-bottom: none;
  margin: 4ch 0 0;
  color: var(--muted);
}
header.site nav a, footer.site a { text-decoration: none; }
header.site nav.crumbs a { margin-right: 0.5ch; }
header.site nav.primary a { margin-left: 1.5ch; }

/* ---- PAGE HEADER ---- */

header.page h1 {
  margin: 0 0 0.5ch;
  font-size: 18px;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.5ch;
}
header.page .meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2ch;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5ch;
}
header.page .meta a { color: var(--muted); }
header.page .meta a:hover { color: var(--accent); }

.header-row {
  display: flex;
  align-items: center;
  gap: 2ch;
  margin: 2ch 0;
}
.header-row .page-logo {
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  display: block;
  border: 1px solid var(--fg);
  margin: 0;
}
.header-row blockquote.summary { margin: 0; flex: 1; }

blockquote.summary {
  padding: 1ch 2ch;
  border-left: 2px solid var(--rule);
  color: var(--fg);
  font-style: normal;
}

/* ---- BOX (TOC, INCOMING, TAG CLOUD) ---- */

.toc, .backlinks, .incoming, .tags > table {
  border: 1px solid var(--rule);
  padding: 1ch 2ch;
  margin: 2ch 0;
  position: relative;
}
.boxlabel {
  display: inline-block;
  position: absolute;
  top: -0.8em;
  left: 1ch;
  padding: 0 0.6ch;
  background: var(--bg);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.toc ul, .backlinks ul {
  list-style: none;
  padding: 0;
  margin: 0.5ch 0;
}
.toc li, .backlinks li { padding: 0.1ch 0; }
.toc li.lvl-3 { padding-left: 2ch; }
.toc li::before, .backlinks li::before {
  content: "· ";
  color: var(--muted);
}

/* ---- TWO-COLUMN LISTINGS ---- */

ul.two-col {
  list-style: none;
  padding: 0;
  margin: 1ch 0 2ch;
  /* "two columns if each can be at least 32ch wide; else one." */
  columns: 32ch 2;
  column-gap: 3ch;
  font-size: 13px;
}
ul.two-col li {
  break-inside: avoid;
  padding: 0.3ch 0;
  display: grid;
  grid-template-columns: 12ch 1fr;
  gap: 1ch;
  align-items: baseline;
  border-bottom: 1px dashed var(--soft);
}
ul.two-col li .date { color: var(--muted); white-space: nowrap; }
ul.two-col li .title a { text-decoration: underline; text-underline-offset: 2px; }

p.month-note {
  margin: 1ch 0;
  font-size: 14px;
  line-height: 1.6;
}

ul.two-col.cloud li {
  grid-template-columns: 4ch 1fr;
}
ul.two-col.cloud .count {
  color: var(--muted);
  text-align: right;
}

/* ---- TABLES (listings, cloud) ---- */

table.listing, table.cloud {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.listing td, table.cloud td {
  padding: 0.4ch 1ch 0.4ch 0;
  vertical-align: baseline;
  border-bottom: 1px dashed var(--soft);
}
table.listing td.date { color: var(--muted); white-space: nowrap; width: 14ch; }
table.listing td.tags {
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  padding-right: 0;
}
table.listing td.tags a { margin-left: 0.8ch; }
table.listing td.summary { color: var(--muted); }
table.cloud td.count {
  color: var(--muted);
  text-align: right;
  width: 4ch;
  padding-right: 1ch;
}

/* ---- BODY PROSE ---- */

.body { margin: 2ch 0; }
.body h2, .body h3 {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.3ch;
  margin: 3ch 0 1ch;
}
.body h2 { font-size: 16px; }
.body h3 { font-size: 14px; border-bottom-style: dashed; }
.body p { margin: 1ch 0; }
.body ul, .body ol { padding-left: 2.5ch; }
.body code {
  background: var(--soft);
  padding: 0 0.4ch;
  border: 1px solid #e0e0e0;
}
.body pre {
  background: var(--soft);
  border: 1px solid #e0e0e0;
  padding: 1ch 1.5ch;
  overflow-x: auto;
}
.body pre code { background: none; border: none; padding: 0; }
.body blockquote {
  margin: 1.5ch 0;
  padding-left: 2ch;
  border-left: 2px solid var(--muted);
  color: var(--muted);
}
.body hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 3ch 0;
}
.body img, .body video {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  margin: 1.5ch 0;
}

/* ---- FIGURES ---- */

.body figure {
  margin: 2ch 0;
  padding: 0;
  width: fit-content;
  max-width: 100%;
}
.body figure img { margin: 0; }
.body figcaption {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 0.4ch 1ch;
  border: 1px solid var(--rule);
  border-top: none;
}

/* ---- EXTERNAL LINK ARROW ---- */

.body a[href^="http://"]::after,
.body a[href^="https://"]::after {
  content: " ↗";
  color: var(--muted);
  font-size: 0.85em;
}

/* ---- HEADING ANCHORS ---- */

.body h2 a.heading-anchor,
.body h3 a.heading-anchor {
  margin-left: 0.6ch;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
  transition: opacity 80ms ease;
}
.body h2:hover a.heading-anchor,
.body h3:hover a.heading-anchor { opacity: 1; }
.body h2 a.heading-anchor:hover,
.body h3 a.heading-anchor:hover { color: var(--accent); }

/* ---- FOOTNOTES ---- */

.footnotes {
  margin-top: 4ch;
  padding-top: 1ch;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--muted);
}
.footnotes ol { padding-left: 3ch; }
.footnotes li { margin: 0.5ch 0; }
.footnotes p { margin: 0; }
.footnotes a.footnote-backref { text-decoration: none; margin-left: 0.4ch; }

sup.footnote-ref a {
  text-decoration: none;
  padding: 0 0.2ch;
}
.body table {
  border-collapse: collapse;
  margin: 1.5ch 0;
}
.body th, .body td {
  border: 1px solid var(--rule);
  padding: 0.4ch 1ch;
  text-align: left;
}

/* ---- HOME ---- */

.home article.intro { margin-bottom: 3ch; }

/* ---- YEAR / MONTH BLOCK (home + /YYYY/) ---- */

section.year { margin-top: 3ch; }
section.year > h2 {
  font-size: 20px;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.5ch;
  margin: 0 0 1ch;
  text-transform: uppercase;
}
section.year > h2 a { text-decoration: none; color: var(--fg); }
section.year > h2 a:hover { color: var(--accent); }

p.year-empty {
  color: var(--muted);
  margin: 1ch 0 2ch;
}

ul.month-index {
  list-style: none;
  padding: 0;
  margin: 0 0 2ch;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5ch;
  font-size: 12px;
}
ul.month-index li::before { content: "· "; color: var(--muted); }
ul.month-index li:first-child::before { content: ""; }
ul.month-index a { text-decoration: none; }
ul.month-index a:hover { color: var(--accent); }

section.month { margin: 2.5ch 0; }
section.month h3 {
  font-size: 14px;
  letter-spacing: 0.06em;
  margin: 0 0 0.5ch;
  border-bottom: 1px dashed var(--muted);
  padding-bottom: 0.3ch;
  text-transform: uppercase;
}
section.month h3 a { text-decoration: none; color: var(--fg); }
section.month h3 a:hover { color: var(--accent); }
section.month table.listing { margin: 0; }

p.archives-line {
  margin-top: 4ch;
  padding-top: 1ch;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
p.archives-line a { color: var(--fg); }
p.archives-line a:hover { color: var(--accent); }

/* ---- LINKS PAGE ---- */

section.links h1 {
  font-size: 18px;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.5ch;
  margin: 0 0 1ch;
  text-transform: uppercase;
}
p.links-intro {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 3ch;
}
/* ---- TAG PAGE ---- */

section.tag h1, section.tags h1, section.notfound h1, section.sitemap h1 {
  font-size: 18px;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.5ch;
  margin: 0 0 2ch;
  text-transform: uppercase;
}

/* ---- MEDIA GALLERY ---- */

section.media h2 {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px dashed var(--muted);
  padding-bottom: 0.3ch;
  margin: 3ch 0 1ch;
  color: var(--muted);
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.6ch;
  margin-bottom: 2ch;
}
.media-grid a {
  display: block;
  position: relative;
  line-height: 0;
}
.media-grid img, .media-grid video {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border: 1px solid var(--rule);
  display: block;
  margin: 0;
}
.media-grid .media-video .play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  background: rgba(0, 0, 0, 0.4);
  font-size: 24px;
  pointer-events: none;
}

/* ---- SITEMAP ---- */

section.sitemap h2 {
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px dashed var(--muted);
  padding-bottom: 0.3ch;
  margin: 3ch 0 1ch;
}
ul.link-grid {
  list-style: none;
  padding: 0;
  margin: 0 0 2ch;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5ch;
  font-size: 13px;
}
ul.link-grid li::before { content: "· "; color: var(--muted); }
ul.link-grid li:first-child::before { content: ""; }

/* footer link picks up muted color via inheritance */
footer.site a { color: inherit; }
footer.site a:hover { color: var(--accent); }

/* ---- RESPONSIVE ---- */

@media (max-width: 480px) {
  body { padding: 1ch 1.5ch 4ch; }
  header.site { flex-direction: column; align-items: flex-start; }
  header.site nav.primary { margin-top: 0.5ch; }
  header.site nav.primary a { margin: 0 1.5ch 0 0; }
  table.listing td.date { width: auto; }
}
