/* blu.cx: dark, serif, gothic. One file, no build step. */

@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/EBGaramond-Regular.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "UnifrakturMaguntia";
  src: url("/fonts/UnifrakturMaguntia-Regular.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #111;
  --raised: #181818;
  --text: #fffff8;
  --soft: #d9d6cc;
  --muted: #8f8b80;
  --rule: #2c2b28;
  --gold: #f7dd5f;
  --blood: #9e2b25;
  --code-bg: #1e1e2e;
  --code: #e8c872;
  --measure: 40rem;
  --wide: 62rem;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "EB Garamond", Garamond, "Times New Roman", serif;
  font-size: 1.3rem;
  line-height: 1.6;
  font-variant-numeric: oldstyle-nums proportional-nums;
}

a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; transition: color 0.15s; }
a:hover, a:focus-visible { color: var(--gold); }
:focus-visible { outline: 1px dashed var(--gold); outline-offset: 3px; }

.blackletter { font-family: "UnifrakturMaguntia", serif; font-weight: 400; letter-spacing: 0.01em; }

body > * { width: min(92%, var(--measure)); margin-left: auto; margin-right: auto; }
body.wide > * { width: min(92%, var(--wide)); }
body > main.index, body > article { margin-top: 2.5rem; margin-bottom: 3rem; }

/* The bar atop inner pages */
.top-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem;
  padding: 1.25rem 0 1rem; border-bottom: 1px solid var(--rule);
  width: min(92%, var(--wide));
}
.home-link { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; font-size: 1.8rem; line-height: 1; }
.crest-small img { width: 1.4rem; height: auto; display: block; }

.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; font-variant: small-caps; letter-spacing: 0.06em; font-size: 1.05rem; }
.site-nav a { text-decoration: none; color: var(--soft); }
.site-nav a:hover { color: var(--gold); }
.site-nav a[aria-current] { color: var(--text); border-bottom: 1px solid var(--blood); }

/* Home */
.masthead { text-align: center; padding: 3.5rem 0 1.5rem; }
.masthead .crest img { width: 59px; height: 80px; }
.masthead h1 { font-size: clamp(3rem, 9vw, 4.75rem); margin: 0.5rem 0 0; line-height: 1.05; }
.masthead .greek { font-size: 1.8rem; font-style: italic; margin: 0.25rem 0 0.75rem; color: var(--soft); }
.masthead .tagline { color: var(--soft); margin: 0 auto 1.25rem; max-width: 34rem; }
.masthead .site-nav { justify-content: center; font-size: 1.15rem; }

.wide section { margin: 3rem auto; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--rule); margin-bottom: 1.25rem; }
.section-head h2 { font-variant: small-caps; letter-spacing: 0.08em; font-size: 1.35rem; margin: 0 0 0.25rem; font-weight: 400; color: var(--soft); }
.section-head a { font-size: 1rem; color: var(--muted); text-decoration: none; }
.section-head a:hover { color: var(--gold); }

.lead { padding: 0.5rem 0 1.75rem; border-bottom: 1px solid var(--rule); margin-bottom: 0.5rem; }
.lead h2 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); line-height: 1.15; margin: 0.2rem 0 0.6rem; }
.lead h2 a { text-decoration: none; }
.lead p { color: var(--soft); max-width: var(--measure); margin: 0 0 0.75rem; }
.more { font-variant: small-caps; letter-spacing: 0.05em; }
.dagger { color: var(--blood); }

.kicker { margin: 0; font-variant: small-caps; letter-spacing: 0.08em; font-size: 1rem; color: var(--muted); }
.kicker a { text-decoration: none; color: var(--muted); }
.kicker a:hover { color: var(--gold); }

/* Lists of writing */
.entries { list-style: none; margin: 0; padding: 0; }
.entry { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0 1.25rem; padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
.entry:last-child { border-bottom: 0; }
.entry time { color: var(--muted); font-size: 1rem; padding-top: 0.2rem; white-space: nowrap; }
.entry .title { font-size: 1.3rem; text-decoration: none; line-height: 1.3; }
.entry .title:hover { text-decoration: underline; }
.entry .kind { margin-left: 0.6rem; font-variant: small-caps; letter-spacing: 0.06em; font-size: 0.9rem; color: var(--muted); }
.entry p { margin: 0.25rem 0 0; color: var(--soft); font-size: 1.1rem; line-height: 1.5; }
@media (max-width: 34rem) {
  .entry { grid-template-columns: 1fr; }
  .entry time { padding: 0; }
}

.fragments { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.fragments li { border-left: 2px solid var(--blood); padding: 0.1rem 0 0.1rem 1rem; }
.fragments .date { font-variant: small-caps; letter-spacing: 0.05em; color: var(--muted); text-decoration: none; }
.fragments .title { color: var(--soft); font-style: italic; }
.fragments p { margin: 0.35rem 0 0; font-size: 1.1rem; line-height: 1.5; color: var(--soft); }

.projects { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.project-card { background: var(--raised); border: 1px solid var(--rule); border-radius: 2px; padding: 1rem 1.25rem; }
.project-card h3 { margin: 0 0 0.3rem; font-size: 1.4rem; display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.project-card h3 a { text-decoration: none; }
.project-card p { margin: 0; color: var(--soft); font-size: 1.1rem; line-height: 1.45; }
.project-card .latest { margin-top: 0.6rem; font-size: 1rem; color: var(--muted); }
.badge { font-size: 0.8rem; font-variant: small-caps; letter-spacing: 0.08em; color: var(--muted); border: 1px solid var(--rule); padding: 0 0.4rem; border-radius: 2px; margin-left: 0.5rem; }

.home-quote { text-align: center; }
.home-about p { max-width: var(--measure); }
.also, .sections { color: var(--muted); }
.also a, .sections a { color: var(--soft); }

/* Quotations */
.quotation { margin: 0 0 2.5rem; }
.quotation blockquote { margin: 0; font-size: 1.35rem; font-style: italic; color: var(--text); }
.quotation blockquote p { margin: 0 0 0.75rem; }
.home-quote .quotation blockquote { font-size: 1.5rem; }
.quotation blockquote::before { content: "“"; display: block; font-size: 3rem; line-height: 0.6; color: var(--blood); margin-bottom: 0.4rem; font-style: normal; }
.quotation figcaption { color: var(--muted); font-size: 1.05rem; }
.quotation figcaption .when a { color: var(--muted); }
.quotes .quotation { border-bottom: 1px solid var(--rule); padding-bottom: 2rem; }

/* A piece of writing */
.piece > header, .index > header { margin-bottom: 2rem; }
.piece h1, .index h1 { font-size: clamp(2.1rem, 5vw, 2.9rem); line-height: 1.12; margin: 0.25rem 0 0.75rem; font-weight: 700; }
.meta { color: var(--muted); font-size: 1rem; margin: 0; }
.standfirst { font-size: 1.4rem; color: var(--soft); font-style: italic; margin: 1rem 0 0; line-height: 1.45; }
.links { margin-top: 0.75rem; font-variant: small-caps; letter-spacing: 0.05em; }

.toc, .series { background: var(--raised); border: 1px solid var(--rule); padding: 0.75rem 1.25rem; margin: 0 0 2rem; font-size: 1.1rem; }
.toc summary { cursor: pointer; font-variant: small-caps; letter-spacing: 0.08em; color: var(--soft); }
.toc ol, .series ol { margin: 0.5rem 0 0; padding-left: 1.5rem; }
.toc .toc-3 { margin-left: 1.25rem; list-style: none; font-size: 1rem; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.series .here { color: var(--gold); }

.piece > footer { margin-top: 3rem; border-top: 1px solid var(--rule); padding-top: 1.25rem; }
.project-note { color: var(--soft); margin-bottom: 1rem; }
.tags a { color: var(--muted); text-decoration: none; margin-right: 0.5rem; font-size: 1rem; }
.tags a:hover { color: var(--gold); }
.neighbours { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1.5rem; }
.neighbours a { text-decoration: none; display: block; line-height: 1.3; }
.neighbours .kicker { display: block; }
.neighbours .newer { text-align: right; }

/* The journal */
.month > h2 { font-variant: small-caps; letter-spacing: 0.08em; font-weight: 400; color: var(--soft); border-bottom: 1px solid var(--rule); margin-top: 3rem; }
.month > h2 a { text-decoration: none; }
article.fragment { margin: 1.75rem 0 2.5rem; }
article.fragment > header .date { font-variant: small-caps; letter-spacing: 0.05em; color: var(--muted); text-decoration: none; }
article.fragment > header .date::before { content: "† "; color: var(--blood); }
article.fragment h3 { margin: 0.1rem 0 0.25rem; font-size: 1.5rem; }

.tag-cloud { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.tag-cloud .count { color: var(--muted); font-size: 0.9rem; margin-left: 0.3rem; }
.commits { padding-left: 0; list-style: none; }
.commits li { padding: 0.5rem 0; border-bottom: 1px solid var(--rule); }
.commits time { color: var(--muted); font-size: 1rem; display: inline-block; min-width: 9rem; }
.feed { font-size: 1rem; color: var(--muted); margin-top: 2rem; }

.site-footer { text-align: center; color: var(--muted); font-size: 1rem; padding: 2.5rem 0 3rem; border-top: 1px solid var(--rule); margin-top: 3rem; }
.site-footer .crest-small { display: inline-block; margin-bottom: 0.5rem; }
.site-footer .crest-small img { width: 1.8rem; }
.site-footer p { margin: 0.25rem 0; }
.site-footer a { color: var(--soft); }

/* Rendered Markdown */
.markdown > :first-child { margin-top: 0; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { position: relative; line-height: 1.25; }
.markdown h1 { font-size: 2rem; margin: 2.5rem 0 1rem; }
.markdown h2 { font-size: 1.7rem; margin: 2.5rem 0 0.75rem; }
.markdown h3 { font-size: 1.4rem; margin: 2rem 0 0.5rem; }
.markdown h4 { font-size: 1.2rem; margin: 1.5rem 0 0.5rem; }
.markdown .anchor { text-decoration: none; margin-left: 0.4rem; color: var(--muted); opacity: 0; font-size: 0.75em; }
.markdown .anchor::before { content: "#"; }
.markdown :is(h1, h2, h3, h4):hover .anchor, .markdown .anchor:focus { opacity: 1; }
.markdown p, .markdown ul, .markdown ol { margin: 0 0 1.1rem; }
.markdown ul, .markdown ol { padding-left: 1.75rem; }
.markdown li + li { margin-top: 0.4rem; }
.markdown ol ul > li, .markdown ol ol > li { list-style-type: lower-alpha; }
.markdown hr { border: 0; text-align: center; margin: 2.5rem 0; }
.markdown hr::after { content: "† † †"; color: var(--blood); letter-spacing: 1em; }
.markdown blockquote { margin: 1.5rem 0; padding: 0.5rem 1.5rem; border-left: 3px solid var(--soft); font-style: italic; color: #ddd; }
.markdown blockquote p:last-child { margin-bottom: 0; }
.markdown code { background: var(--code-bg); color: var(--code); padding: 0.1em 0.35em; border-radius: 3px; font-size: 0.8em; font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace; }
.markdown pre { overflow-x: auto; background: #1a1b26; padding: 1rem 1.1rem; border-radius: 3px; margin: 0 0 1.25rem; line-height: 1.45; }
.markdown pre code { background: none; color: inherit; padding: 0; font-size: 0.85rem; }
.markdown pre code.hljs { padding: 0; background: none; }
.markdown img { display: block; margin: 1.5rem auto; max-width: 100%; max-height: 80vh; height: auto; width: auto; object-fit: contain; background: #222; }
.markdown picture { display: block; }
.markdown table { width: 100%; border-collapse: collapse; font-size: 1rem; border: 1px solid #333; min-width: 36rem; }
.markdown th { text-align: left; border-bottom: 2px solid #555; background: #1a1a1a; padding: 0.5rem 0.75rem; }
.markdown td { border-bottom: 1px solid #333; padding: 0.5rem 0.75rem; }
.markdown tr:nth-child(even) { background: #151515; }
.markdown .footnotes { font-size: 1.05rem; color: var(--soft); border-top: 1px solid var(--rule); margin-top: 2.5rem; padding-top: 1rem; }
.markdown .task-list-item { list-style: none; }
.stage-item { border-left: 2px solid #444; padding: 0.25rem 0 0.25rem 1rem; }

.table-wrapper { overflow-x: auto; width: 100%; margin: 0 0 1.25rem; -webkit-overflow-scrolling: touch; }
.code-block-wrapper { position: relative; }
.code-block-wrapper .copy-btn {
  position: absolute; top: 0.5rem; right: 0.5rem; background: #444; color: #ccc; border: 0;
  padding: 0.2rem 0.7rem; border-radius: 3px; font: 0.8rem sans-serif; cursor: pointer; opacity: 0; transition: opacity 0.2s;
}
.code-block-wrapper:hover .copy-btn, .code-block-wrapper .copy-btn:focus { opacity: 1; }
.code-block-wrapper .copy-btn:hover { background: #555; color: #fff; }

@media (hover: none) { .code-block-wrapper .copy-btn, .markdown .anchor { opacity: 0.6; } }

/* Featured writing */
.featured { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.featured-card { border: 1px solid var(--rule); border-top: 2px solid var(--blood); background: var(--raised); padding: 1rem 1.25rem 1.1rem; }
.featured-card h3 { margin: 0.2rem 0 0.4rem; font-size: 1.45rem; line-height: 1.2; }
.featured-card h3 a { text-decoration: none; }
.featured-card h3 a:hover { text-decoration: underline; }
.featured-card p { margin: 0; color: var(--soft); font-size: 1.1rem; line-height: 1.45; }
.featured-card .kicker { color: var(--muted); }
.featured-block { margin: 1rem 0 2.5rem; }
.featured-block > h2 { font-variant: small-caps; letter-spacing: 0.08em; font-weight: 400; color: var(--soft); font-size: 1.35rem; border-bottom: 1px solid var(--rule); }
