/* schappi.com: terminal-flavoured, one typeface, a character grid. */

@font-face { font-family: "Berkeley Mono"; src: url("/assets/BerkeleyMono-Regular-47f80f40.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Berkeley Mono"; src: url("/assets/BerkeleyMono-Italic-b3028264.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Berkeley Mono"; src: url("/assets/BerkeleyMono-Bold-d0e3e213.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Berkeley Mono"; src: url("/assets/BerkeleyMono-BoldItalic-358fa39e.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }

:root {
  --font: "Berkeley Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --bg: #0e100f;
  --bg-raised: #151817;
  --fg: #d6d9d3;
  --dim: #8e958c;
  --faint: #5f665e;
  --line: #262b28;
  --accent: #86d993;
  --accent-ink: #0e100f;
  --warn: #e6b673;
  --err: #f0837a;
  --selection: #2c4a33;
  --measure: 84ch;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7f6f1; --bg-raised: #efede6; --fg: #1d211e; --dim: #5a6159; --faint: #8b9189;
  --line: #d9d6cc; --accent: #17703a; --accent-ink: #f7f6f1; --warn: #8a5a00; --err: #b3261e;
  --selection: #cfe8d2; color-scheme: light;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  font-feature-settings: "calt" 1;
  -webkit-font-smoothing: antialiased;
}

/* One typeface for everything, including form controls and pasted content. */
button, input, select, textarea, code, pre, kbd, samp { font: inherit; }

::selection { background: var(--selection); }

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3, h4 { font-size: 1rem; font-weight: 700; line-height: 1.4; margin: 0; }
p { margin: 0 0 1.6rem; }
img { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.6rem 0; }

.wrap { width: 100%; max-width: var(--measure); margin-inline: auto; padding-inline: 2ch; }
main.wrap { flex: 1; padding-block: 3.2rem; }
.dim { color: var(--dim); }
.ok { color: var(--accent); }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 2ch; top: 0.5rem; background: var(--bg); padding: 0.2rem 1ch; z-index: 10; }

/* ---------- header / footer ---------- */
.site-header { border-bottom: 1px solid var(--line); }
.site-header__row { display: flex; align-items: center; gap: 3ch; padding-block: 0.8rem; flex-wrap: wrap; }
.site-name { color: var(--fg); font-weight: 700; text-decoration: none; }
.site-name .prompt { color: var(--accent); margin-right: 1ch; }
.site-nav { display: flex; gap: 2ch; flex-wrap: wrap; margin-right: auto; }
.site-nav a { color: var(--dim); text-decoration: none; }
.site-nav a:hover { color: var(--fg); }
.site-nav a.is-current { color: var(--accent); }
.site-nav a.is-current::before { content: "/"; color: var(--faint); }
.theme-toggle, .linklike { background: none; border: 0; padding: 0; color: var(--dim); cursor: pointer; }
.theme-toggle:hover, .linklike:hover { color: var(--fg); }
.site-footer { border-top: 1px solid var(--line); color: var(--dim); }
.site-footer__row { display: flex; justify-content: space-between; gap: 2ch; padding-block: 1.2rem; flex-wrap: wrap; }
.site-footer__links { display: flex; gap: 2ch; }
.site-footer a { color: var(--dim); }
.site-footer form { display: inline; }

.flash { border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 0.4rem 1.5ch; }
.flash--err { border-left-color: var(--err); }

/* ---------- shared blocks ---------- */
.page-title { margin-bottom: 0.4rem; }
.page-title::before { content: "# "; color: var(--faint); }
.block { margin-top: 3.2rem; }
.block__title { color: var(--dim); font-weight: 400; display: flex; align-items: center; gap: 2ch; margin-bottom: 1.2rem; }
.block__title::before { content: "##"; color: var(--faint); }
.block__title::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.crumb { color: var(--dim); margin-bottom: 0.8rem; }
.tag { color: var(--dim); font-weight: 400; border: 1px solid var(--line); padding: 0 0.8ch; margin-left: 1ch; font-size: 0.87rem; white-space: nowrap; }

/* ---------- profile ---------- */
.profile__name { margin-bottom: 1.2rem; }
.profile__bio { margin-bottom: 0.8rem; overflow-wrap: anywhere; }
.profile p:last-child { margin-bottom: 0; }

/* ---------- article lists ---------- */
.entries { list-style: none; margin: 0; padding: 0; }
.entry { display: grid; grid-template-columns: 11ch minmax(0, 1fr) 7ch; column-gap: 2ch; padding-block: 1.2rem; border-top: 1px dashed var(--line); }
.entry:first-child { border-top: 0; padding-top: 0; }
.entry__date, .entry__meta { color: var(--dim); white-space: nowrap; }
.entry__meta { text-align: right; }
.entry__title { font-weight: 700; }
.entry__title a { color: var(--fg); text-decoration: none; }
.entry__title a:hover { color: var(--accent); text-decoration: underline; }
.entry__excerpt { color: var(--dim); margin: 0.4rem 0 0; overflow-wrap: anywhere; }
.entry__image { display: block; margin-top: 0.8rem; }
.entry__image img { display: block; width: 100%; max-height: 18rem; object-fit: cover; border: 1px solid var(--line); }
.entries--compact .entry { padding-block: 0.4rem; border-top: 0; }
.entries--compact .entry__title { font-weight: 400; }

/* ---------- article ---------- */
.article__title { font-size: 1.6rem; line-height: 1.3; margin-bottom: 0.8rem; text-wrap: balance; }
.article__header { margin-bottom: 1.6rem; }
.article__header p:last-child { margin-bottom: 0; }
.article__banner { display: block; width: 100%; border: 1px solid var(--line); margin-bottom: 1.6rem; }
.prose { max-width: 76ch; overflow-wrap: break-word; }
.prose * { font-family: inherit !important; }
.prose > div { margin-bottom: 1.6rem; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin: 2.4rem 0 0.8rem; }
.prose h1::before, .prose h2::before { content: "## "; color: var(--faint); }
.prose h3::before, .prose h4::before { content: "### "; color: var(--faint); }
.prose h1, .prose h2 { font-size: 1.2rem; }
.prose ul, .prose ol { margin: 0 0 1.6rem; padding-left: 3ch; }
.prose ul { list-style: none; }
.prose ul > li { position: relative; }
.prose ul > li::before { content: "-"; position: absolute; left: -2ch; color: var(--faint); }
.prose li { margin-bottom: 0.4rem; }
.prose li p { margin: 0; }
.prose blockquote { margin: 0 0 1.6rem; padding-left: 2ch; border-left: 2px solid var(--accent); color: var(--dim); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose img { display: block; border: 1px solid var(--line); margin: 1.6rem 0; }
.prose figure { margin: 1.6rem 0; }
.prose figcaption { color: var(--dim); margin-top: -0.8rem; }
.prose code { background: var(--bg-raised); border: 1px solid var(--line); padding: 0 0.6ch; font-size: 0.93rem; }
.prose pre { background: var(--bg-raised); border: 1px solid var(--line); padding: 0.8rem 2ch; margin: 0 0 1.6rem; overflow-x: auto; line-height: 1.5; tab-size: 2; }
.prose pre code { background: none; border: 0; padding: 0; }
.prose table { border-collapse: collapse; margin-bottom: 1.6rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 0.2rem 1.5ch; text-align: left; }

/* ---------- forms ---------- */
.input, .select, .textarea {
  background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 0;
  padding: 0.35rem 1ch; min-width: 0; width: 100%;
}
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--accent); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 0;
  padding: 0.35rem 2ch; cursor: pointer; text-decoration: none; white-space: nowrap; font-weight: 700;
}
.btn:hover { filter: brightness(1.1); }
.btn--ghost { background: none; color: var(--fg); border-color: var(--line); font-weight: 400; }
.btn--ghost:hover { border-color: var(--dim); filter: none; }
.btn--danger { background: none; color: var(--err); border-color: var(--line); font-weight: 400; }
.btn--danger:hover { border-color: var(--err); filter: none; }
.btn:disabled { opacity: 0.5; cursor: default; }
.field-error { color: var(--err); margin: 0.4rem 0 0; flex-basis: 100%; }

.subscribe { display: flex; align-items: center; gap: 1ch; flex-wrap: wrap; margin-bottom: 0.8rem; }
.subscribe .input { flex: 1 1 24ch; width: auto; }
.subscribe__label { color: var(--dim); }
.subscribe__label::after { content: ":"; }
.subscribe__done { margin-bottom: 0.8rem; }
.subscribe-block p { margin-bottom: 0.8rem; }

/* ---------- projects ---------- */
.projects { list-style: none; margin: 1.6rem 0 0; padding: 0; }
.project { display: grid; grid-template-columns: 9ch minmax(0, 1fr); gap: 3ch; padding-block: 1.6rem; border-top: 1px dashed var(--line); }
.project__icon { width: 9ch; height: auto; display: block; }
.project__image { width: 100%; max-width: 48ch; margin-top: 0.8rem; border: 1px solid var(--line); display: block; }
.project__title { margin-bottom: 0.4rem; }
.project__stars { margin-left: 1ch; color: var(--dim); font-weight: normal; white-space: nowrap; }
.project__body p { margin-bottom: 0.4rem; }
.project__link { overflow-wrap: anywhere; }
.project:not(:has(.project__icon)) { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 640px) {
  html { font-size: 14px; }
  .entry { grid-template-columns: minmax(0, 1fr) auto; }
  .entry__date { grid-column: 1; grid-row: 1; }
  .entry__meta { grid-column: 2; grid-row: 1; }
  .entry__body { grid-column: 1 / -1; }
  .project { grid-template-columns: 6ch minmax(0, 1fr); gap: 2ch; }
  .project__icon { width: 6ch; }
  main.wrap { padding-block: 2.4rem; }
}

@media (prefers-reduced-motion: no-preference) {
  a, .btn, .input { transition: color 0.12s, border-color 0.12s, filter 0.12s; }
}

/* ---------- utilities ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clip { max-width: 36ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; gap: 2ch; flex-wrap: wrap; align-items: center; }
.row > .field { flex: 1 1 24ch; }
.scroll-x { overflow-x: auto; }
.danger { color: var(--err); }
.spaced { margin-top: 1.6rem; }
[hidden] { display: none !important; }

/* ---------- forms (admin, login) ---------- */
.form { margin-top: 1.6rem; }
.form--narrow { max-width: 40ch; }
.field { margin-bottom: 1.2rem; }
.field label { display: block; color: var(--dim); margin-bottom: 0.2rem; }
.textarea { resize: vertical; line-height: 1.6; display: block; }
.select { appearance: none; padding-right: 3ch; background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%); background-position: calc(100% - 1.6ch) 50%, calc(100% - 1ch) 50%; background-size: 0.6ch 0.6ch; background-repeat: no-repeat; }
input[type="file"].input { width: auto; flex: 1 1 30ch; }

/* ---------- admin ---------- */
.subnav { display: flex; gap: 2ch; flex-wrap: wrap; align-items: center; padding-bottom: 0.8rem; margin-bottom: 2.4rem; border-bottom: 1px dashed var(--line); }
.subnav a { color: var(--dim); text-decoration: none; }
.subnav a:hover { color: var(--fg); }
.subnav a.is-current { color: var(--accent); }
.subnav__action { margin-left: auto; color: var(--accent) !important; }
.filters { display: flex; gap: 2ch; flex-wrap: wrap; margin: 1.2rem 0; }
.filters a { color: var(--dim); text-decoration: none; }
.filters a.is-current { color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(14ch, 1fr)); gap: 1px; margin: 1.6rem 0 0; padding: 1px; }
.stats > div { outline: 1px solid var(--line); padding: 0.8rem 1.5ch; }
.stats dt { color: var(--dim); }
.stats dd { margin: 0; font-size: 1.6rem; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stats dd a { color: inherit; text-decoration: none; }
.stats dd a:hover { color: var(--accent); }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 0.3rem 2ch 0.3rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table thead th { color: var(--dim); font-weight: 400; }
.table tbody th { font-weight: 400; color: var(--dim); white-space: nowrap; }
.table .num { text-align: right; }
.table form { display: inline; }
.table--bars th, .table--bars td { border-bottom: 0; padding-block: 0.05rem; }
.table--bars th { width: 11ch; }
.table--bars .num { width: 8ch; }
.bar-cell { width: 100%; vertical-align: middle; }
.bar { display: block; height: 0.8rem; background: var(--accent); min-width: 1px; opacity: 0.8; }

.status { color: var(--dim); }
.status::before { content: "● "; }
.status--published { color: var(--accent); }
.status--scheduled { color: var(--warn); }

.thumbs { list-style: none; padding: 0; margin: 1.6rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(24ch, 1fr)); gap: 2ch; }
.thumb { border: 1px solid var(--line); padding: 1ch; min-width: 0; }
.thumb img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.thumb__url { display: block; font-size: 0.87rem; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0.4rem 0; }
.thumb .row { gap: 1.5ch; font-size: 0.87rem; }
.thumb form { display: inline; }

.snippet { background: var(--bg-raised); border: 1px solid var(--line); padding: 0.8rem 2ch; overflow-x: auto; margin: 0 0 1.2rem; }
.token { overflow-wrap: anywhere; color: var(--accent); }
.flash p { margin: 0.2rem 0; }

/* ---------- editor ---------- */
.editor__title { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--fg); font-size: 1.6rem; font-weight: 700; padding: 0.4rem 0; margin-bottom: 1.2rem; }
.editor__title:focus { outline: 0; border-bottom-color: var(--accent); }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.5ch; position: sticky; top: 0; z-index: 2; background: var(--bg); padding-block: 0.4rem; border-bottom: 1px solid var(--line); }
.editor:not(.editor--ready) .toolbar { display: none; }
.toolbar__gap { flex: 1; }
.tool { background: none; color: var(--dim); border: 1px solid var(--line); min-width: 4ch; padding: 0.1rem 0.8ch; cursor: pointer; }
.tool:hover { color: var(--fg); border-color: var(--dim); }
.tool[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.tool:disabled { opacity: 0.4; cursor: default; }
.editor__surface { min-height: 24rem; }
.editor__content { min-height: 24rem; padding-block: 1.2rem; outline: 0; max-width: none; }
.editor__content p.is-editor-empty:first-child::before { content: attr(data-placeholder); color: var(--faint); float: left; height: 0; pointer-events: none; }
.editor__content img.ProseMirror-selectednode { outline: 2px solid var(--accent); }
.editor__source { margin-block: 1.2rem; font-size: 0.93rem; }
.editor__state { color: var(--dim); }
.editor__state.is-error { color: var(--err); }
.publish { display: flex; gap: 2ch; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1.2rem; }
.publish .field { margin: 0; }
.publish .btn, .publish .editor__state { margin-bottom: 1px; }
.banner-preview img { display: block; max-height: 16rem; border: 1px solid var(--line); margin-bottom: 0.8rem; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(22ch, 1fr)); gap: 2ch; }
.card { border: 1px solid var(--line); padding: 1ch 1.5ch; display: grid; gap: 0.6rem; align-content: start; }
.card__preview img { display: block; max-height: 9rem; border: 1px solid var(--line); }
.dialog { background: var(--bg); color: var(--fg); border: 1px solid var(--dim); padding: 1.6rem 3ch; width: min(96vw, 110ch); }
.dialog::backdrop { background: rgb(0 0 0 / 0.7); }
.dialog__canvas { max-height: 65vh; margin-bottom: 1.2rem; }
.dialog__canvas img { display: block; max-width: 100%; max-height: 65vh; }
