/* The blog wears the main site's plain-page kit: paper, ink, and one pale
   blueprint highlighter used only as a fill. Same fonts, same tokens. */

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/geist-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/geist-mono-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Gabarito";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/gabarito-latin.woff2") format("woff2");
}

:root {
  --bg: #f7f6f1;
  --bg-pane: #fdfcfa;
  --bg-inset: #efeee8;
  --fg: #14161a;
  --fg-dim: #585c64;
  --fg-faint: #676b73;
  --rule: #e1dfd7;
  --hair: rgb(20 22 26 / 0.08);
  --hi: #a6e3ff;
  --hi-ink: #0b1f2a;
  --hi-wash: rgb(166 227 255 / 0.45);
  --green: #2f7d5b;
  --red: #c4453c;
  --code-bg: #efeee8;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --e-1: 0 1px 2px rgb(20 22 26 / 0.06);
  --e-2: 0 1px 2px rgb(20 22 26 / 0.05), 0 6px 16px -6px rgb(20 22 26 / 0.12);

  --font-sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-display: "Gabarito", "Geist", ui-sans-serif, system-ui, sans-serif;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f1012;
  --bg-pane: #16171a;
  --bg-inset: #1c1d21;
  --fg: #f0efe9;
  --fg-dim: #a8a9a3;
  --fg-faint: #8e8f95;
  --rule: #2a2b30;
  --hair: rgb(255 255 255 / 0.07);
  --green: #3fbf8f;
  --red: #f2555a;
  --code-bg: #1c1d21;
  --e-1: inset 0 1px 0 rgb(255 255 255 / 0.04), 0 1px 2px rgb(0 0 0 / 0.32);
  --e-2: inset 0 1px 0 rgb(255 255 255 / 0.04), 0 2px 4px rgb(0 0 0 / 0.3), 0 10px 24px -10px rgb(0 0 0 / 0.6);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  letter-spacing: -0.025em;
  line-height: 1.15;
  text-wrap: balance;
}

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--hi);
  color: var(--hi-ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

.wrap-wide {
  max-width: 1400px;
}

.meta {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.01em;
  color: var(--fg-faint);
  margin: 0;
}

/* ----------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule);
  background: var(--bg-pane);
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background var(--dur-1) var(--ease),
    border-color var(--dur-1) var(--ease),
    transform var(--dur-1) var(--ease),
    opacity var(--dur-1) var(--ease);
}
.btn:hover {
  background: var(--bg-inset);
  border-color: var(--fg-faint);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
  box-shadow: var(--e-1);
}
.btn-primary:hover {
  background: var(--fg);
  border-color: var(--fg);
  opacity: 0.86;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--fg-dim);
}
.btn-ghost:hover {
  background: var(--bg-inset);
  border-color: transparent;
  color: var(--fg);
}
.btn-danger:hover {
  color: var(--red);
}
.btn-sm {
  font-size: 13px;
  padding: 7px 11px;
}
.btn-icon {
  padding: 7px;
  min-width: 32px;
  min-height: 32px;
}
.btn-icon .i-moon,
:root[data-theme="dark"] .btn-icon .i-sun {
  display: none;
}
:root[data-theme="dark"] .btn-icon .i-moon {
  display: block;
}

/* ----------------------------------------------------------- top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}
.wordmark {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark-sub {
  font-weight: 500;
  color: var(--fg-faint);
  margin-left: 6px;
}
.topbar-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ------------------------------------------------------------- index */

.hero {
  padding: 72px 0 40px;
}
.hero-tight {
  padding: 40px 0 24px;
}
.hero h1 {
  font-size: clamp(40px, 7vw, 64px);
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 0 0 12px;
}
.lede {
  font-size: 18px;
  color: var(--fg-dim);
  max-width: 56ch;
  margin: 0;
}
.lede a {
  color: var(--fg);
}

.excerpt {
  color: var(--fg-dim);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty {
  color: var(--fg-dim);
  padding: 32px 0;
  border-top: 1px solid var(--rule);
}

.featured {
  border-top: 1px solid var(--rule);
  padding: 32px 0 40px;
}
.featured-link {
  display: grid;
  gap: 28px;
  text-decoration: none;
}
.featured.has-cover .featured-link {
  grid-template-columns: 1.15fr 1fr;
  align-items: center;
}
.featured-cover,
.post-row-cover,
.post-cover {
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-inset);
  border: 1px solid var(--hair);
}
.featured-cover img,
.post-row-cover img,
.post-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.featured-cover {
  aspect-ratio: 16 / 10;
}
.featured-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.featured-title {
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 700;
  margin: 0;
}
.featured-link:hover .featured-title,
.post-row:hover .post-row-title {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}
.read-more {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  margin-top: 4px;
}
.read-more span {
  display: inline-block;
  transition: transform var(--dur-2) var(--ease);
}
.featured-link:hover .read-more span {
  transform: translateX(3px);
}

.post-list {
  list-style: none;
  margin: 0 0 80px;
  padding: 0;
}
.post-list li {
  border-top: 1px solid var(--rule);
}
.post-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 24px;
  padding: 28px 0;
  text-decoration: none;
}
.post-row:has(.post-row-cover) {
  grid-template-columns: 170px 1fr 160px;
}
.post-row .meta {
  padding-top: 5px;
}
.post-row-title {
  font-size: 22px;
  font-weight: 650;
  margin: 0 0 8px;
}
.post-row-cover {
  aspect-ratio: 4 / 3;
}

@media (max-width: 720px) {
  .hero {
    padding: 48px 0 28px;
  }
  .featured.has-cover .featured-link {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .post-row,
  .post-row:has(.post-row-cover) {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .post-row-cover {
    display: none;
  }
  .topbar-nav .btn-sm {
    padding: 7px 8px;
  }
  .wordmark-sub {
    display: none;
  }
}

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

.post {
  max-width: 700px;
  margin: 0 auto;
  padding: 48px 0 96px;
}
.post-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 32px;
}
.back {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--fg-dim);
  text-decoration: none;
  align-self: flex-start;
}
.back:hover {
  color: var(--fg);
}
.post-title {
  font-size: clamp(32px, 5.5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.035em;
  margin: 0;
}
.post-cover {
  margin: 0 0 36px;
  aspect-ratio: 16 / 9;
}

/* ------------------------------------------------------------- prose */

.prose {
  font-size: 17.5px;
  line-height: 1.72;
  overflow-wrap: break-word;
}
.prose > :first-child {
  margin-top: 0;
}
.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose figure,
.prose table,
.prose .katex-display {
  margin: 0 0 1.25em;
}
.prose h2 {
  font-size: 28px;
  margin: 2em 0 0.6em;
}
.prose h3 {
  font-size: 21px;
  margin: 1.8em 0 0.5em;
}
.prose h4 {
  font-size: 18px;
  margin: 1.6em 0 0.4em;
}
.prose a {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.prose a:hover {
  background: var(--hi-wash);
}
.prose strong {
  font-weight: 650;
}
.prose ul,
.prose ol {
  padding-left: 1.4em;
}
.prose li + li {
  margin-top: 0.35em;
}
.prose li::marker {
  color: var(--fg-faint);
}
.prose blockquote {
  border-left: 3px solid var(--hi);
  padding: 2px 0 2px 18px;
  color: var(--fg-dim);
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.5em 0;
}
.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--r);
  margin: 0 auto 1.25em;
}
.prose figure img {
  margin-bottom: 10px;
}
.prose figcaption {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-faint);
  text-align: center;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--code-bg);
  border: 1px solid var(--hair);
  border-radius: 4px;
  padding: 0.12em 0.36em;
}
.prose pre {
  font-size: 14px;
  line-height: 1.6;
  background: var(--code-bg);
  border: 1px solid var(--hair);
  border-radius: var(--r);
  padding: 16px 18px;
  overflow-x: auto;
}
.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  display: block;
  overflow-x: auto;
}
.prose th,
.prose td {
  border-bottom: 1px solid var(--rule);
  padding: 8px 12px;
  text-align: left;
}
.prose th {
  font-family: var(--font-display);
}
.prose .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}
.prose .katex {
  font-size: 1.08em;
}

/* Code colours: ink on paper with two accents, not a rainbow. */
.hljs-comment,
.hljs-quote {
  color: var(--fg-faint);
  font-style: italic;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-built_in,
.hljs-literal {
  color: #2c62b8;
}
.hljs-string,
.hljs-attr,
.hljs-template-tag,
.hljs-regexp {
  color: #2f7d5b;
}
.hljs-number,
.hljs-symbol,
.hljs-variable,
.hljs-params {
  color: #9a5b17;
}
.hljs-title,
.hljs-section,
.hljs-type {
  color: #8a4fb0;
}
:root[data-theme="dark"] .hljs-keyword,
:root[data-theme="dark"] .hljs-selector-tag,
:root[data-theme="dark"] .hljs-built_in,
:root[data-theme="dark"] .hljs-literal {
  color: #7aa2f7;
}
:root[data-theme="dark"] .hljs-string,
:root[data-theme="dark"] .hljs-attr,
:root[data-theme="dark"] .hljs-template-tag,
:root[data-theme="dark"] .hljs-regexp {
  color: #3fbf8f;
}
:root[data-theme="dark"] .hljs-number,
:root[data-theme="dark"] .hljs-symbol,
:root[data-theme="dark"] .hljs-variable,
:root[data-theme="dark"] .hljs-params {
  color: #e0af68;
}
:root[data-theme="dark"] .hljs-title,
:root[data-theme="dark"] .hljs-section,
:root[data-theme="dark"] .hljs-type {
  color: #bb9af7;
}

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

.footer {
  border-top: 1px solid var(--rule);
  margin-top: 40px;
}
.footer-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 20px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--fg-faint);
}
.footer a {
  color: var(--fg-dim);
}

/* ------------------------------------------------------------- admin */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  color: var(--fg-dim);
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-faint);
}
.chip-published {
  color: var(--fg);
}
.chip-published::before {
  background: var(--green);
}

.admin-list {
  list-style: none;
  margin: 0 0 80px;
  padding: 0;
}
.admin-list li {
  border-top: 1px solid var(--rule);
}
.admin-row-link {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 8px;
  text-decoration: none;
  border-radius: var(--r-sm);
}
.admin-row-link:hover {
  background: var(--bg-inset);
}
.admin-row-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
}
@media (max-width: 640px) {
  .admin-row-link {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .admin-row-link .chip {
    justify-self: start;
  }
}

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