/* ==========================================================================
   TheDefaced — site theme
   Built around the TheDefaced banner logo (the glasses guy + worn lettering): greyscale
   on charcoal, the bright-white "D" as the only highlight, a near-black halo, a steep
   diagonal and a faint carbon weave. White is the accent: it marks the ONE thing in focus.
   Every colour is a variable: retune the palette here.
   ========================================================================== */

@font-face {
  font-family: "Anton";
  src: url("../fonts/anton-latin.woff") format("woff");   /* SIL OFL 1.1, see ../fonts/Anton-OFL.txt */
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg:          #1c1c1c;              /* the logo's charcoal */
  --bg-2:        #171717;
  --surface:     #222222;
  --surface-2:   #292929;
  --line:        #2e2e2e;
  --line-2:      #3c3c3c;
  --halo:        #0b0b0b;              /* the dark outline around the letters */
  --text:        #bdbdbd;
  --text-strong: #f2f2f2;              /* the bright "D" */
  --muted:       #909090;              /* "EFACED" grey */
  --dim:         #666666;

  --accent:      #f2f2f2;
  --accent-2:    #ffffff;
  --on-accent:   #111111;
  --accent-soft: rgba(255, 255, 255, .06);
  --accent-line: rgba(255, 255, 255, .32);

  /* functional colours only (callouts, diffs, admin state), kept quiet */
  --ok:     #8fb59b;
  --info:   #8fa8bf;
  --warn:   #c9ad78;
  --danger: #cf8a85;

  --code-bg:     #121212;
  --code-inline: #e2e2e2;

  /* syntax: desaturated so code stays readable without breaking the monochrome */
  --hl-k: #c9a2a6;  --hl-t: #c8b791;  --hl-b: #94b6ba;  --hl-s: #a9bd9d;  --hl-c: #5f5f5f;
  --hl-n: #c8a487;  --hl-f: #a3b5cc;  --hl-v: #b7a6c6;  --hl-r: #cdbd8c;  --hl-p: #8e8e8e;  --hl-a: #9cbcb3;

  --display: "Anton", Impact, "Haettenschweiler", "Arial Narrow Bold", sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SF Mono", "Fira Code", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;

  --tilt:    -35deg;                    /* the mark's diagonal */
  --slant:   -20deg;                    /* softer version for small accents */
  --measure: 45rem;
  --wide:    68rem;
  --radius:  4px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background-color: var(--bg);
  /* carbon weave: two faint diagonal hatches + a soft top light */
  background-image:
    radial-gradient(ellipse 70% 45% at 50% -8%, rgba(255, 255, 255, .045), transparent 70%),
    repeating-linear-gradient(45deg,  rgba(255, 255, 255, .014) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, .22) 0 2px, transparent 2px 6px);
  background-attachment: fixed;
  font: 400 1.0625rem/1.72 var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* the old site's watermark, reborn: a huge tilted wordmark, barely there */
body::before {
  content: "TheDefaced";
  position: fixed;
  right: -6vw;
  bottom: 8vh;
  z-index: -1;
  font: 400 clamp(7rem, 24vw, 22rem)/1 var(--display);
  color: rgba(255, 255, 255, .018);
  transform: rotate(var(--tilt));
  transform-origin: 100% 100%;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

::selection { background: var(--accent); color: var(--on-accent); }

a { color: var(--text-strong); text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
a:hover { color: var(--accent-2); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.wrap { width: 100%; max-width: var(--measure); margin: 0 auto; padding: 0 1.25rem; }
main.wrap { flex: 1; padding-top: 2.75rem; padding-bottom: 4rem; }

.mono  { font-family: var(--mono); }
.dim   { color: var(--dim); }
.small { font-size: .82rem; }
.sr    { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip  { position: absolute; left: -999px; top: .5rem; background: var(--accent); color: var(--on-accent); padding: .3rem .7rem; z-index: 10; }
.skip:focus { left: .5rem; }

/* a small slanted bar: the mark's diagonal as a UI accent */
.slash::before {
  content: ""; display: inline-block; width: .3em; height: .95em; margin-right: .45em; vertical-align: -.1em;
  background: var(--accent); transform: skewX(var(--slant));
}

/* code is shown exactly as typed: no ligatures (-> must not become an arrow, != must not become a symbol) */
code, pre, kbd, samp, .mono, input, textarea,
.code code, .prose code { font-variant-ligatures: none !important; font-feature-settings: "liga" 0, "calt" 0 !important; }

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

.masthead {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(rgba(0, 0, 0, .35), transparent);
}
.masthead-inner { padding-top: 2.3rem; padding-bottom: 1.1rem; }

/* The TheDefaced banner: the original 2007 art (face + worn lettering), cut out of its flat grey box and
   set in a modern panel. The panel keeps the old rectangle: dark behind the face so it melts into the page,
   lifting to the original box grey behind the lettering so the black letters keep their contrast. */
.brand {
  display: block;
  width: 36rem;
  max-width: 100%;
  line-height: 0;
  text-decoration: none;
  border-radius: 6px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, .05), transparent 22%, transparent 78%, rgba(0, 0, 0, .25)),
    repeating-linear-gradient(45deg,  rgba(255, 255, 255, .018) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, .14) 0 2px, transparent 2px 6px),
    linear-gradient(90deg, #202020 0%, #252525 36%, #3b3b3b 60%, #454444 78%, #424141 100%);
  box-shadow: 0 0 0 1px var(--halo), inset 0 0 0 1px rgba(255, 255, 255, .06), 0 16px 36px -14px rgba(0, 0, 0, .8);
  transition: box-shadow .2s ease;
}
.brand:hover { box-shadow: 0 0 0 1px var(--halo), inset 0 0 0 1px rgba(255, 255, 255, .16), 0 16px 36px -14px rgba(0, 0, 0, .8); }
.brand img { display: block; width: 100%; height: auto; }
.brand-sm, .brand-sm:hover { width: auto; display: inline-block; border-radius: 4px; box-shadow: 0 0 0 1px var(--halo), inset 0 0 0 1px rgba(255, 255, 255, .06); }
.brand-sm img { width: auto; height: 2.3rem; }

.tagline {
  margin: .85rem 0 1.3rem;
  font: .84rem/1.4 var(--mono);
  color: var(--muted);
}
.tagline-mark { color: var(--dim); }

.nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.4rem; font: .9rem var(--mono); }
.nav > a { color: var(--muted); text-decoration: none; padding: .15rem 0; position: relative; }
.nav > a::before { content: "./"; color: var(--dim); }
.nav > a:hover, .nav > a[aria-current="page"] { color: var(--text-strong); }
.nav > a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px;
  background: var(--accent); transform: skewX(var(--tilt));
}
.nav-search { margin-left: auto; }
.nav-search input {
  width: 9.5rem;
  font: .82rem var(--mono);
  color: var(--text);
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .3rem .55rem;
  transition: width .2s ease, border-color .2s;
}
.nav-search input:focus { width: 13rem; border-color: var(--accent-line); outline: none; }

/* ------------------------------------------------------------------ front page */

.readme {
  position: relative;
  margin: 0 0 2.75rem;
  padding: 1.1rem 1.25rem 1.1rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  color: var(--text);
  background: linear-gradient(100deg, rgba(255, 255, 255, .035), transparent 55%), var(--surface);
  font-size: .98rem;
}
.readme p { margin: 0; }
.readme-label { font: 400 .95rem var(--display); letter-spacing: .14em; color: var(--text-strong) !important; margin-bottom: .3rem !important; }

.log { list-style: none; margin: 0; padding: 0; }
.entry {
  display: grid;
  grid-template-columns: 7.2rem 1fr;
  gap: 0 1.25rem;
  padding: 1.35rem 0;
  border-top: 1px dashed var(--line);
}
.entry:first-child { border-top: 0; padding-top: 0; }
.entry-date { font: .8rem/2.6 var(--mono); color: var(--dim); white-space: nowrap; }
.entry-title { margin: 0 0 .4rem; font: 400 1.55rem/1.2 var(--display); letter-spacing: .012em; }
.entry-title a { text-decoration: none; color: #d4d4d4; position: relative; }
.entry-title a::before {
  content: ""; position: absolute; left: -1.1rem; top: .18em; width: .3rem; height: .8em;
  background: var(--accent); transform: skewX(var(--slant)) scaleY(0); transform-origin: bottom; transition: transform .18s ease;
}
.entry-title a:hover { color: var(--accent-2); }
.entry-title a:hover::before, .entry-title a:focus-visible::before { transform: skewX(var(--slant)) scaleY(1); }
.entry-summary { margin: 0 0 .4rem; color: var(--muted); font-size: .97rem; }
.tagline-list { margin: 0; }

.tag { font: .78rem var(--mono); color: var(--muted); text-decoration: none; }
.tag:hover { color: var(--accent-2); }

.badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: .4rem;
  padding: .05rem .4rem;
  font: 500 .66rem/1.5 var(--mono);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px dashed var(--line-2);
  border-radius: 3px;
}

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 2.5rem; font: .88rem var(--mono); }
.pager a { text-decoration: none; color: var(--muted); }
.pager a:hover { color: var(--accent-2); }
.pager-pos { color: var(--dim); }

.empty { color: var(--muted); font-family: var(--mono); }

.list-head { margin-bottom: 2rem; }
.list-head h1 { margin: 0; font: 400 2.5rem/1.1 var(--display); letter-spacing: .01em; color: var(--text-strong); }
.eyebrow { margin: 0 0 .2rem; font: .78rem var(--mono); color: var(--muted); }
.eyebrow::before { content: "$ "; color: var(--dim); }

/* archive */
.year { margin-bottom: 2.2rem; }
.year-head { font: 400 1.6rem/1.1 var(--display); letter-spacing: .02em; color: var(--text-strong); margin: 0 0 .6rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line); }
.year-list { list-style: none; margin: 0; padding: 0; }
.year-list li { display: flex; gap: 1rem; align-items: baseline; padding: .28rem 0; }
.year-list time { font: .8rem var(--mono); color: var(--dim); flex: none; width: 3.2rem; }
.year-list a { text-decoration: none; }
.year-list a:hover { color: var(--accent-2); }

.tag-cloud { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.tag-cloud a {
  display: inline-block; padding: .35rem .7rem; font: .88rem var(--mono); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text);
}
.tag-cloud a:hover { border-color: var(--accent-line); color: var(--text-strong); }

.search-form { display: flex; gap: .5rem; margin-bottom: 1.5rem; }
.search-form input {
  flex: 1; font: 1rem var(--mono); color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: .55rem .75rem;
}
.search-form button, .btn {
  font: 600 .88rem var(--mono); color: var(--on-accent); background: var(--accent); border: 0; border-radius: var(--radius);
  padding: .55rem 1rem; cursor: pointer; text-decoration: none; display: inline-block;
}
.search-form button:hover, .btn:hover { background: var(--accent-2); color: var(--on-accent); }
.search-count { margin-bottom: 1.5rem; }

.errorpage { padding: 3rem 0; }
.error-code { font: 400 7rem/1 var(--display); color: var(--text-strong); margin: 0; transform: rotate(-4deg); transform-origin: 0 100%;
  filter: drop-shadow(.04em .05em 0 var(--halo)); }
.errorpage h1 { font: 400 1.9rem var(--display); letter-spacing: .02em; color: var(--text-strong); }

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

.post-head { margin-bottom: 2.2rem; }
.post-meta { margin: 0 0 .7rem; font: .8rem var(--mono); color: var(--dim); display: flex; flex-wrap: wrap; gap: .2rem .5rem; align-items: baseline; }
.post-meta time { color: var(--muted); }
.post-title {
  margin: 0;
  font: 400 clamp(2.1rem, 5.5vw, 3.1rem)/1.08 var(--display);
  letter-spacing: .008em;
  filter: drop-shadow(.025em .04em 0 var(--halo));
  color: var(--text-strong);
  text-wrap: balance;
}

.legacy-note {
  margin-top: 1.25rem;
  padding: .7rem .95rem;
  font-size: .87rem;
  color: var(--muted);
  background: repeating-linear-gradient(-45deg, var(--surface), var(--surface) 10px, var(--bg-2) 10px, var(--bg-2) 20px);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
}
.legacy-label { font: 700 .68rem var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--warn); margin-right: .4rem; }

.post-foot { margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.post-nav a {
  display: flex; flex-direction: column; gap: .15rem; padding: .8rem 1rem; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-weight: 600;
}
.post-nav a:hover { border-color: var(--accent-line); color: var(--text-strong); }
.post-nav .dim { font: 400 .72rem var(--mono); }
.post-nav-older { text-align: right; grid-column: 2; }

/* ------------------------------------------------------------------ comments */

.comments { margin-top: 3.5rem; }
.comments-head { margin: 0 0 1.4rem; font: 400 1.75rem/1.1 var(--display); letter-spacing: .012em; color: var(--text-strong); }
.comment-list { list-style: none; margin: 0 0 2.5rem; padding: 0; }
.comment { padding: 1.1rem 0; border-top: 1px dashed var(--line); }
.comment:first-child { border-top: 0; padding-top: 0; }
.comment-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .8rem; margin: 0 0 .4rem; font: .8rem var(--mono); color: var(--dim); }
.comment-author { font-weight: 700; color: var(--text-strong); text-decoration: none; }
a.comment-author:hover { text-decoration: underline; }
.comment-date, .comment-reply-to { color: var(--dim); text-decoration: none; }
.comment-date:hover, .comment-reply-to:hover { color: var(--text-strong); }
.comment-badge {
  padding: 0 .4rem; font: 500 .64rem/1.6 var(--mono); letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); border: 1px dashed var(--line-2); border-radius: 3px;
}
.comment-body { color: var(--text); font-size: .98rem; overflow-wrap: anywhere; }
.comment-body p { margin: 0 0 .7rem; }
.comment-body p:last-child { margin-bottom: 0; }
.comment.is-legacy .comment-body { color: #a9a9a9; }

.comment-form { display: grid; gap: .9rem; padding: 1.2rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.comment-form label { display: grid; gap: .3rem; font: .78rem var(--mono); color: var(--muted); }
.comment-form input, .comment-form textarea {
  width: 100%; font: 1rem/1.5 var(--sans); color: var(--text-strong); background: rgba(0, 0, 0, .3);
  border: 1px solid var(--line-2); border-radius: var(--radius); padding: .5rem .65rem;
}
.comment-form textarea { resize: vertical; min-height: 8rem; }
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--accent-line); }
.comment-form [aria-invalid="true"] { border-color: var(--danger); }
.cf-row { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.cf-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: 0; }
.cf-foot button {
  font: 600 .88rem var(--mono); color: var(--on-accent); background: var(--accent); border: 0;
  border-radius: var(--radius); padding: .55rem 1.1rem; cursor: pointer;
}
.cf-foot button:hover { background: var(--accent-2); }
.field-error, .comment-error { color: var(--danger); font: .78rem var(--mono); }
.comment-error { margin: 0; }
.comment-notice { padding: .9rem 1.1rem; border-left: 3px solid var(--ok); background: var(--surface); border-radius: var(--radius); }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 640px) { .cf-row { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ prose (rendered markdown) */

.prose { overflow-wrap: break-word; }
.prose::after { content: ""; display: table; clear: both; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose .table-wrap { margin: 0 0 1.25rem; }

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  position: relative;
  color: var(--text-strong);
  line-height: 1.3;
  letter-spacing: -.012em;
  margin: 2.4rem 0 .85rem;
  clear: both;
}
.prose h1, .prose h2 { font: 400 1.75rem/1.2 var(--display); letter-spacing: .012em; padding-bottom: .35rem; border-bottom: 1px solid var(--line); }
.prose h3 { font-size: 1.22rem; font-weight: 650; }
.prose h4, .prose h5, .prose h6 { font: 700 .95rem var(--mono); color: var(--text); text-transform: lowercase; }
.prose .anchor {
  position: absolute; left: -1.35em; width: 1.2em; text-align: center;
  color: var(--accent); text-decoration: none; font-family: var(--mono); font-weight: 400; opacity: .55;
}
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose .anchor:focus { opacity: 1; }

.prose a:hover { color: var(--accent-2); text-decoration-color: currentColor; }
.prose strong { color: var(--text-strong); font-weight: 650; }
.prose mark { background: rgba(255, 255, 255, .16); color: var(--text-strong); padding: 0 .15em; border-radius: 2px; }
.prose del { color: var(--muted); }
.prose hr { border: 0; height: 1px; margin: 2.6rem 0; clear: both; background: linear-gradient(90deg, transparent, var(--line-2), transparent); }
.prose hr::after { content: none; }

.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin: .25rem 0; }
.prose li > ul, .prose li > ol { margin: .25rem 0; }
.prose ul > li::marker { color: var(--muted); content: "/  "; font-family: var(--mono); font-size: .85em; }
.prose ol > li::marker { color: var(--muted); font-family: var(--mono); font-size: .88em; }
.prose li.task-item { list-style: none; margin-left: -1.4rem; }
.prose li.task-item::marker { content: none; }
.task {
  display: inline-block; width: .95em; height: .95em; margin-right: .45rem; vertical-align: -.1em;
  border: 1.5px solid var(--line-2); border-radius: 3px;
}
.task.done { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--bg); }

.prose blockquote {
  margin-left: 0; padding: .15rem 0 .15rem 1.1rem;
  border-left: 2px solid var(--line-2); color: var(--muted);
}
.prose blockquote > :last-child { margin-bottom: 0; }

.prose code {
  font: .86em var(--mono);
  color: var(--code-inline);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: .08em .35em;
}
.prose a code { color: inherit; }

/* redacted / spoiler */
.redact {
  background: var(--text);
  color: transparent;
  border-radius: 2px;
  cursor: pointer;
  transition: background .2s, color .2s;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  user-select: none;
}
.redact code, .redact a { visibility: hidden; }
.redact:hover, .redact:focus, .redact.revealed {
  background: var(--accent-soft); color: var(--text-strong); user-select: auto;
}
.redact:hover code, .redact:focus code, .redact.revealed code,
.redact:hover a, .redact:focus a, .redact.revealed a { visibility: visible; }

/* callouts */
.callout {
  margin: 0 0 1.4rem; padding: .85rem 1.1rem; background: var(--surface);
  border: 1px solid var(--line); border-left: 3px solid var(--info); border-radius: var(--radius);
}
.callout > :last-child { margin-bottom: 0; }
.callout-title { margin: 0 0 .35rem !important; font: 700 .74rem var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--info); }
.callout-tip     { border-left-color: var(--ok); }    .callout-tip .callout-title     { color: var(--ok); }
.callout-warning { border-left-color: var(--warn); }  .callout-warning .callout-title { color: var(--warn); }
.callout-danger  { border-left-color: var(--danger); background: linear-gradient(90deg, rgba(207, 138, 133, .1), var(--surface) 40%); }
.callout-danger .callout-title { color: var(--danger); }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.prose table, .admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.prose th, .admin-table th {
  text-align: left; font: 600 .74rem var(--mono); text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); background: var(--surface); padding: .55rem .8rem; border-bottom: 1px solid var(--line);
}
.prose td, .admin-table td { padding: .5rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose tr:last-child td, .admin-table tr:last-child td { border-bottom: 0; }
.prose tbody tr:nth-child(even) { background: rgba(255, 255, 255, .015); }
.al-center { text-align: center !important; } .al-right { text-align: right !important; } .al-left { text-align: left !important; }

/* ------------------------------------------------------------------ code blocks */

.code {
  clear: both;
  margin: 1.6rem 0;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.code figcaption {
  display: flex; align-items: center; gap: .75rem; min-height: 2rem;
  padding: .3rem .5rem .3rem .9rem;
  font: .74rem var(--mono); color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.code figcaption::before {
  content: ""; flex: none; width: .5rem; height: .5rem; border-radius: 50%;
  background: var(--line-2); box-shadow: .8rem 0 0 var(--line-2), 1.6rem 0 0 var(--line-2); margin-right: 1.6rem;
}
.code-title { color: var(--text); }
.code-lang { margin-left: auto; color: var(--dim); }
.code-copy {
  font: .72rem var(--mono); color: var(--muted); background: transparent; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 3px; padding: .12rem .5rem;
}
.code-lang + .code-copy { margin-left: 0; }
.code-title + .code-copy, figcaption > .code-copy:first-child { margin-left: auto; }
.code-copy:hover { color: var(--text-strong); border-color: var(--muted); }
.code-copy.done { color: var(--ok); border-color: var(--ok); }

.code pre { margin: 0; padding: .8rem 0; overflow-x: auto; tab-size: 4; }
.code code {
  display: block; min-width: max-content;
  font: .85rem/1.62 var(--mono); color: #d6d6d6; counter-reset: ln;
  background: none; border: 0; border-radius: 0; padding: 0;
}
.code .ln { display: block; padding: 0 1.1rem; white-space: pre; }
.code.numbered .ln { padding-left: 0; }
.code.numbered .ln::before {
  counter-increment: ln; content: counter(ln);
  display: inline-block; width: 3.4em; padding-right: 1.1em; text-align: right;
  color: var(--dim); opacity: .6; user-select: none;
}
.code .ln.hl { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.code .ln.hl::before { color: var(--accent-2); opacity: 1; }

.hl-k { color: var(--hl-k); }  .hl-t { color: var(--hl-t); }  .hl-b { color: var(--hl-b); }
.hl-s { color: var(--hl-s); }  .hl-c { color: var(--hl-c); font-style: italic; }
.hl-n { color: var(--hl-n); }  .hl-f { color: var(--hl-f); }  .hl-v { color: var(--hl-v); }
.hl-r { color: var(--hl-r); }  .hl-p { color: var(--hl-p); }  .hl-a { color: var(--hl-a); }
.hl-pr { color: var(--accent-2); user-select: none; }
.hl-o { color: #9a9a9a; }
.hl-ins { color: var(--ok); background: rgba(95, 191, 138, .08); display: inline-block; min-width: 100%; }
.hl-del { color: var(--danger); background: rgba(207, 138, 133, .08); display: inline-block; min-width: 100%; }
.hl-hunk { color: var(--info); }

/* ------------------------------------------------------------------ images */

.prose figure { margin: 0; }
.prose figure.img { margin: 1.8rem 0; max-width: 100%; }
.prose figure.img img, .img-inline img {
  display: block; max-width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 4px; background: var(--surface);
}
.prose figure.img.plain img { border: 0; background: none; border-radius: 0; }
.prose figure.img a.zoom { display: block; cursor: zoom-in; }
.prose figure.img figcaption {
  margin-top: .55rem; font: .78rem/1.5 var(--mono); color: var(--muted);
}
.prose figure.img figcaption::before { content: "fig. "; color: var(--dim); }

.img-inline { display: inline-block; vertical-align: middle; max-width: 100%; }
.img-inline img { display: inline-block; max-height: 1.6em; width: auto; border: 0; background: none; vertical-align: middle; }

/* size presets */
.size-auto  { width: fit-content; }
.size-tiny  { width: 25%; }
.size-small { width: 33.333%; }
.size-half  { width: 50%; }
.size-large { width: 75%; }
.size-full  { width: 100%; }
.size-tiny img, .size-small img, .size-half img, .size-large img, .size-full img { width: 100%; }
.size-wide {
  width: min(var(--wide), calc(100vw - 2.5rem));
  max-width: none !important;
  margin-left: 50% !important;
  transform: translateX(-50%);
}
.size-wide img { width: 100%; }

/* alignment */
.prose figure.align-center { margin-left: auto; margin-right: auto; }
.prose figure.align-center figcaption { text-align: center; }
.prose figure.align-left  { float: left;  margin: .35rem 1.6rem 1rem 0; }
.prose figure.align-right { float: right; margin: .35rem 0 1rem 1.6rem; }
/* big images never float */
.prose figure.size-large.align-left, .prose figure.size-full.align-left, .prose figure.size-wide.align-left,
.prose figure.size-large.align-right, .prose figure.size-full.align-right, .prose figure.size-wide.align-right {
  float: none; margin: 1.8rem 0;
}
.prose figure.size-auto.align-left, .prose figure.size-auto.align-right { max-width: 50%; }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 2rem; background: rgba(8, 8, 8, .94); cursor: zoom-out; animation: fade .15s ease;
}
.lightbox img { max-width: 100%; max-height: 100%; border: 1px solid var(--line-2); border-radius: 4px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.lightbox-cap { position: absolute; bottom: .9rem; left: 0; right: 0; text-align: center; font: .8rem var(--mono); color: var(--muted); }
@keyframes fade { from { opacity: 0; } }

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

.site-foot { border-top: 1px solid var(--line); }
.foot-inner { display: flex; flex-wrap: wrap; gap: .3rem .8rem; padding-top: 1.5rem; padding-bottom: 2rem; font: .76rem var(--mono); color: var(--dim); }
.foot-inner a { color: var(--muted); text-decoration: none; }
.foot-inner a:hover { color: var(--accent-2); }
.foot-sep { color: var(--line-2); }

/* ------------------------------------------------------------------ responsive */

@media (max-width: 860px) {
  .prose .anchor { position: static; margin-right: .35rem; opacity: .4; }
}

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .masthead-inner { padding-top: 1.5rem; }
  .entry-title a::before { display: none; }
  .nav-search { margin-left: 0; width: 100%; }
  .nav-search input, .nav-search input:focus { width: 100%; }
  .entry { grid-template-columns: 1fr; }
  .entry-date { line-height: 1.6; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-older { grid-column: 1; }

  .prose figure.align-left, .prose figure.align-right {
    float: none; margin: 1.6rem auto; max-width: 100% !important;
  }
  .size-small, .size-half, .size-large { width: 100%; }
  .size-tiny { width: 50%; }
  .code { margin-left: -1.25rem; margin-right: -1.25rem; border-radius: 0; border-left: 0; border-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  body { background: #fff; color: #111; }
  body::before { content: none; }
  .masthead .nav, .site-foot, .code-copy, .post-nav { display: none; }
  .code { background: #f6f6f6; }
  .redact { background: none; color: inherit; }
}
