/* Ledger theme. Change the tokens below to re-skin the whole site. */
:root {
  --paper: #f4edda;
  --paper-2: #ebe2c8;
  --desk: #d6ccb0;
  --ink: #1e2a38;
  --muted: #655f4f;
  --line: rgba(30, 42, 56, .2);
  --line-strong: rgba(30, 42, 56, .38);
  --accent: #b93a1f;      /* vermilion */
  --brass: #a06e1f;
  --ok: #2f6f6a;
  --ok-bg: #dfe8da;
  --err-bg: #f3d9cf;
  --code-bg: #1b2433;
  --code-ink: #efe8d4;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --strip: 28px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b2029; --paper-2: #252b38; --desk: #0f1218; --ink: #ede5d0; --muted: #a9a391;
    --line: rgba(237, 229, 208, .18); --line-strong: rgba(237, 229, 208, .36);
    --accent: #f07a5e; --brass: #d4a24c; --ok: #78c8bd; --ok-bg: #1d3333; --err-bg: #3b2420;
    --code-bg: #10141c;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; padding-left: var(--strip); background: var(--paper); color: var(--ink); font: 18px/1.65 var(--serif); }

/* Continuous-feed perforated edge, fixed to the left of the viewport. */
body::before { content: ""; position: fixed; z-index: 20; inset: 0 auto 0 0; width: var(--strip); background:
  radial-gradient(circle at center, var(--desk) 0 4.5px, transparent 5px) center top / var(--strip) 30px repeat-y, var(--paper);
  border-right: 1px dashed var(--line-strong); pointer-events: none; }
@media (max-width: 600px) { :root { --strip: 18px; } body::before { background-size: var(--strip) 30px; } .site-header { position: static; } }

img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.sr-only, .hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; left: -9999px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 40px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 30; }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.1rem, 5.5vw, 3.2rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); }
h3 { font-size: 1.2rem; }
.mono, .eyebrow, .meta, .tag, .btn, nav, .site-footer, .pill, .table th, label, .form-msg, .share { font-family: var(--mono); }
.muted { color: var(--muted); font-weight: 400; }
.center { text-align: center; }
.right { text-align: right; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; color: var(--brass); margin: 0 0 .9rem; }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 38rem; }
.center .lede { margin-inline: auto; }
em.accent, .accent { color: var(--accent); font-style: italic; white-space: nowrap; }

.wrap { width: min(100% - 40px, 920px); margin-inline: auto; }
.narrow { width: min(100% - 40px, 440px); }
.article-wrap { width: min(100% - 40px, 700px); margin: 40px auto 72px; }
.section { padding-block: 36px; }
.narrow-top { padding-top: 48px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.section-head a { font-family: var(--mono); font-size: .85rem; }

/* Header */
.site-header { border-bottom: 1px dashed var(--line-strong); background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 5; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; padding-block: 14px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-family: var(--serif); font-weight: 700; font-size: 1.1rem; text-decoration: none; color: var(--ink); }
.mark { color: var(--brass); transition: transform .4s; } .mark-in, .weave .w-in { fill: var(--accent); } .brand:hover .mark { transform: scale(1.12) rotate(90deg); }
nav { display: flex; align-items: center; gap: 4px 20px; flex-wrap: wrap; font-size: .88rem; }
nav a:not(.btn) { color: var(--ink); text-decoration: none; padding: 3px 0; border-bottom: 2px solid transparent; }
nav a:not(.btn):hover, nav a[aria-current="page"] { border-bottom-color: var(--accent); }
nav a.cta-link { color: var(--accent); }

/* Buttons */
.btn { display: inline-block; font-size: .92rem; font-weight: 500; background: var(--ink); color: var(--paper); border: 1.5px solid var(--ink); padding: 9px 18px; border-radius: 2px; text-decoration: none; cursor: pointer; transition: background .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-small { padding: 5px 12px; font-size: .85rem; }
.btn-danger { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn-danger:hover { background: var(--accent); color: #fff; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
form.inline { display: inline; }

/* Punch-card hole rows (patterns are generated server-side from a seed). */
.holes { display: flex; justify-content: space-between; gap: 4px; }
.holes i { display: block; width: 6px; height: 11px; border-radius: 2px; background: var(--line); }
.holes i.on { background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }

/* Hero */
.hero { padding: 64px 0 28px; }
.hero h1 { max-width: 17ch; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }

/* Ledger list of patterns */
.ledger { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--line-strong); }
.note { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: baseline; gap: 6px 10px; padding: 14px 0; border-bottom: 1px solid var(--line-strong); }
.note .letter { font-style: italic; font-size: 1.9rem; line-height: 1; color: var(--brass); transition: transform .15s; }
.note:hover .letter { transform: translateX(3px); }
.note .title { border-left: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); padding-left: 14px; }
.note h3 { margin: 0; font-size: 1.2rem; }
.note h3 a { color: var(--ink); text-decoration: none; }
.note h3 a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.note .blurb { display: block; color: var(--muted); font-size: .98rem; margin-top: 2px; }
.note .sub { display: block; font-family: var(--mono); font-size: .76rem; color: var(--muted); margin-top: 6px; }
.note .sub a { text-decoration: none; margin-left: 6px; }
.note .time { font-family: var(--mono); font-size: .8rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 560px) { .note { grid-template-columns: 34px minmax(0, 1fr); } .note .time { grid-column: 2; } .note .letter { font-size: 1.6rem; } }

/* Plain boxes (home "what you'll find") */
.grid { display: grid; gap: 0; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); border-top: 1px solid var(--line-strong); margin-top: 14px; }
.card { padding: 18px 20px 18px 0; border-bottom: 1px solid var(--line-strong); }
@media (min-width: 720px) { .card { border-bottom: 0; padding-right: 28px; } .card + .card { border-left: 1px solid var(--line); padding-left: 22px; } }
.card .num { font-style: italic; color: var(--brass); font-size: 1.1rem; }
.card h3 { margin: 2px 0 .35em; }
.card p { margin: 0; color: var(--muted); font-size: .98rem; }
.empty { padding: 22px 0; color: var(--muted); border-bottom: 1px solid var(--line-strong); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.tag { font-size: .75rem; text-decoration: none; border: 1px solid var(--line-strong); color: var(--ink); padding: 1px 9px; border-radius: 2px; }
.tag.on, .tag:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.filters { margin: 22px 0 8px; }
.meta { font-size: .8rem; color: var(--muted); margin: 0; }

/* Article */
.post-head { margin-bottom: 30px; }
.post-head .holes { max-width: 220px; margin-bottom: 14px; }
.note-label { font-family: var(--mono); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--brass); margin: 0 0 10px; }
.note-label .big { font-family: var(--serif); font-style: italic; text-transform: none; letter-spacing: 0; font-size: 2.2rem; vertical-align: -6px; margin-right: 8px; }
.prose { font-size: 1.1rem; }
.prose h2 { margin-top: 1.8em; } .prose h3 { margin-top: 1.5em; }
.prose img { border-radius: 2px; border: 1px solid var(--line); }
.prose blockquote { margin: 1.2em 0; padding: .1em 1.1em; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }
.prose code { font-family: var(--mono); font-size: .86em; background: var(--paper-2); padding: .12em .4em; border-radius: 2px; }
.prose pre { background: var(--code-bg); color: var(--code-ink); padding: 16px; border-radius: 2px; overflow-x: auto; line-height: 1.5; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; font-size: .98rem; }
.prose th, .prose td { border: 1px solid var(--line-strong); padding: 8px 12px; text-align: left; }
.prose th { background: var(--paper-2); font-family: var(--mono); font-size: .8rem; }
.prose hr { border: 0; border-top: 1px dashed var(--line-strong); margin: 2em 0; }
.share { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: 40px 0 28px; padding: 12px 0; border-block: 1px solid var(--line-strong); font-size: .85rem; }
.back { margin-top: 28px; font-family: var(--mono); font-size: .88rem; }

/* Comments */
.comments { margin: 44px 0 36px; }
.comments h3 { margin-top: 28px; }
.comment-list { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--line-strong); }
.comment { padding: 14px 0; border-bottom: 1px solid var(--line-strong); }
.comment-meta { font-family: var(--mono); font-size: .8rem; color: var(--muted); margin: 0 0 6px; }
.comment-meta strong { color: var(--ink); font-weight: 500; }
.comment-body { margin: 0; white-space: pre-line; overflow-wrap: anywhere; font-size: 1rem; }
.small { font-size: .9rem; }
.comment-form { margin-top: 12px; }
.cf-turnstile { min-height: 65px; }

/* Newsletter: a punch card with a clipped corner and a hole row */
.subscribe-block { background: var(--paper-2); clip-path: polygon(22px 0, 100% 0, 100% 100%, 0 100%, 0 22px); padding: 16px 28px 22px 34px; }
.subscribe-block > .holes { margin: 0 0 16px 4px; }
.subscribe-inner { display: grid; gap: 18px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 780px) { .subscribe-inner { grid-template-columns: 1.1fr 1fr; gap: 32px; } }
.subscribe-block h2 { margin-bottom: .25em; font-size: 1.45rem; } .subscribe-block p { margin: 0; color: var(--muted); font-size: .98rem; }
.subscribe { display: flex; gap: 10px; flex-wrap: wrap; }
.subscribe input[type=email] { flex: 1 1 200px; }
.form-msg { flex-basis: 100%; min-height: 1.4em; font-size: .85rem; margin: 0; color: var(--muted); }
.form-msg.ok { color: var(--ok) !important; } .form-msg.err { color: var(--accent) !important; }

/* Forms */
input[type=text], input[type=email], input[type=password], textarea, select { width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-radius: 2px; padding: 9px 12px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brass); outline-offset: 1px; border-color: var(--ink); }
::placeholder { color: var(--muted); opacity: .75; }
label { display: block; font-weight: 500; font-size: .85rem; }
label input, label textarea, label select { margin-top: 6px; font-family: var(--serif); font-weight: 400; }
label.inline { display: flex; align-items: center; gap: 8px; } label.inline select { width: auto; margin: 0; }
.stack { display: grid; gap: 16px; }
form.stack.card { padding: 20px; border: 1px solid var(--line-strong); }
.row { display: grid; gap: 16px; grid-template-columns: 1fr; } @media (min-width: 700px) { .row { grid-template-columns: 1fr 1fr; } }
.editor { display: grid; gap: 20px; grid-template-columns: 1fr; } @media (min-width: 1000px) { .editor { grid-template-columns: 1fr 1fr; } }
.editor textarea { font-family: var(--mono); font-size: .88rem; line-height: 1.55; }
.label { display: block; font-family: var(--mono); font-weight: 500; font-size: .85rem; margin-bottom: 6px; }
.preview { background: var(--paper); border: 1px solid var(--line-strong); padding: 12px 20px; min-height: 200px; max-height: 620px; overflow: auto; font-size: 1rem; }
.actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.danger-zone { margin-top: 40px; padding-top: 20px; border-top: 1px dashed var(--line-strong); }

/* Admin */
.notice { padding: 12px 16px; margin-bottom: 20px; border-left: 3px solid; font-family: var(--mono); font-size: .88rem; } .notice ul { margin: 0; padding-left: 20px; }
.notice.ok { background: var(--ok-bg); border-color: var(--ok); } .notice.err { background: var(--err-bg); border-color: var(--accent); }
.table { width: 100%; border-collapse: collapse; margin-top: 16px; border-top: 1px solid var(--line-strong); }
.table th, .table td { padding: 11px 12px 11px 0; text-align: left; border-bottom: 1px solid var(--line-strong); font-size: .95rem; }
.table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; }
.pill { font-size: .72rem; padding: 1px 9px; border: 1px solid; border-radius: 2px; text-transform: uppercase; letter-spacing: .06em; }
.pill.published { color: var(--ok); } .pill.draft { color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px dashed var(--line-strong); padding: 24px 0 40px; color: var(--muted); font-size: .8rem; }
.site-footer p { margin: 0 0 4px; }
.weave { display: block; color: var(--brass); margin-bottom: 14px; max-width: 100%; }

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

label.inline input[type=checkbox] { width: auto; margin: 0; }
