/* Holden Salomon: site styles.
   One file, no build step, no web fonts: the stacks below resolve to the platform's own
   UI and monospace faces (SF on macOS and iOS, Segoe on Windows, Roboto on Android).
   Colours are tokens on :root, redefined for dark mode; every text pairing below meets
   WCAG AA (4.5:1) against the surface it sits on. */

/* ---------- Tokens ---------- */

:root {
  color-scheme: light dark;

  --bg: #fcfbf8;
  --surface: #f5f3ee;
  --surface-2: #ebe8e1;
  --text: #22211f;
  --text-strong: #121110;
  --muted: #5c5953;
  --border: #e3dfd6;
  --border-strong: #c9c3b8;
  --accent: #2149b0;
  --accent-strong: #163582;
  --accent-soft: #e6ecfa;
  --on-accent: #ffffff;
  --ok: #1f7a4d;
  --code-bg: #ffffff;
  --figure-bg: #ffffff;
  --mark: #fdf0b0;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans",
    "Liberation Sans", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Code", "JetBrains Mono",
    Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;

  --wrap: 46rem;
  --measure: 70ch;
  --gutter: 1.25rem;
  --radius: 10px;
  --radius-sm: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121416;
    --surface: #191c1f;
    --surface-2: #23272b;
    --text: #e3e1dc;
    --text-strong: #f5f3ef;
    --muted: #a3a09a;
    --border: #2a2e33;
    --border-strong: #3d4248;
    --accent: #8db5ff;
    --accent-strong: #b8d0ff;
    --accent-soft: #1b2639;
    --on-accent: #0b1323;
    --ok: #5fcf95;
    --code-bg: #171a1d;
    /* Diagrams are drawn once, in dark ink on a light ground, and sit on this light
       panel in both modes. A softened white keeps the panel from glaring. */
    --figure-bg: #e9e7e2;
    --mark: #5c4c0c;
  }
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

@media (min-width: 48em) {
  body { font-size: 1.125rem; }
}

h1, h2, h3, h4 {
  color: var(--text-strong);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 0.2em;
}
a:hover {
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
main:focus { outline: none; }

::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }
::target-text { background: var(--mark); color: var(--text-strong); }

img, svg { max-width: 100%; height: auto; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 0.75rem; }

.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}

.sep { color: var(--border-strong); margin-inline: 0.45em; }

/* ---------- Header and footer ---------- */

.site-header { border-bottom: 1px solid var(--border); }

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.15rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-strong);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.wordmark::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 3px;
  background: var(--accent);
}
.wordmark:hover { color: var(--text-strong); }

.site-nav ul {
  display: flex;
  gap: 0.25rem 1.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav a {
  display: inline-block;
  padding-block: 0.2rem;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}
.site-nav a:hover { color: var(--text-strong); }
.site-nav a[aria-current="page"],
.site-nav a.is-active {
  color: var(--text-strong);
  text-decoration: underline 2px var(--accent);
  text-underline-offset: 0.5em;
}

.site-footer {
  margin-top: 6rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.75rem 2.5rem;
}
.footer-inner p { margin: 0; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--text-strong); }

/* ---------- Shared page furniture ---------- */

.eyebrow {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
}
.eyebrow a { color: inherit; }

.page-head { margin: 3.5rem 0 2.5rem; }
.page-head h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 1.55rem + 2vw, 2.6rem);
  letter-spacing: -0.025em;
}
.page-lede {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 1.125em;
  line-height: 1.55;
}
.page-lede p { margin: 0; }

.button {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.05rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}
.button:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.button-quiet {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-strong);
}
.button-quiet:hover { background: var(--surface); border-color: var(--text-strong); color: var(--text-strong); }

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

/* ---------- Home ---------- */

.intro { margin: 4.5rem 0 4rem; }
.intro-title {
  margin: 0 0 1.25rem;
  font-size: clamp(2.5rem, 1.6rem + 4vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}
.intro-body p {
  margin: 0 0 1em;
  max-width: 60ch;
  color: var(--muted);
}
.intro-body p:first-child {
  color: var(--text);
  font-size: 1.25em;
  line-height: 1.5;
  letter-spacing: -0.005em;
}
.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2rem 0 0;
}
.availability {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}
.availability-dot {
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
  transform: translateY(-0.05em);
}

.home-section { margin-top: 4rem; }
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.section-head h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}
.section-head a {
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}
.section-head a:hover { text-decoration: underline; }

/* ---------- Project cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
}
.card-list {
  display: grid;
  gap: 1rem;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem 1.3rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 120ms ease;
}
.card:hover { border-color: var(--border-strong); }
.card:target { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.card-title {
  margin: 0;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}
.card-title a { color: var(--text-strong); text-decoration: none; }
.card-title a:hover { color: var(--accent); text-decoration: underline; }

.card-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.chips li {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.4;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: auto 0 0;
  padding-top: 0.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
}
.card-links a { text-decoration: none; }
.card-links a:hover { text-decoration: underline; }
.private {
  color: var(--muted);
  font-weight: 500;
}
.card-links .private::before {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.45em;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  vertical-align: 0.05em;
}

/* ---------- Post lists ---------- */

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.post-item {
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--border);
}
.post-item:first-child { padding-top: 0.25rem; }
.post-item-title {
  margin: 0 0 0.35rem;
  font-size: 1.1875rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.post-item-title a { color: var(--text-strong); text-decoration: none; }
.post-item-title a:hover { color: var(--accent); text-decoration: underline; }
.post-item-desc {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.96875rem;
  line-height: 1.55;
}
.post-item-meta {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}
.list-foot {
  margin-top: 2rem;
  font-size: 0.9375rem;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tag-cloud a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  text-decoration: none;
}
.tag-cloud a:hover { border-color: var(--accent); color: var(--accent); }
.tag-cloud .count { color: var(--muted); font-size: 0.8125rem; }

/* ---------- Post ---------- */

.post-head { margin: 3.5rem 0 2rem; }
.post-title {
  margin: 0 0 0.9rem;
  font-size: clamp(2rem, 1.45rem + 2.4vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.028em;
}
.post-dek {
  margin: 0 0 1.25rem;
  max-width: 60ch;
  color: var(--muted);
  font-size: 1.1875em;
  line-height: 1.5;
  text-wrap: pretty;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}
.post-meta .sep { margin-inline: 0.6em; }
.post-tags { display: inline-flex; flex-wrap: wrap; gap: 0.2rem 0.75rem; }
.post-tags a::before { content: "#"; opacity: 0.6; }

.project-box {
  margin: 0 0 2.5rem;
  padding: 0.95rem 1.15rem 1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface);
  font-size: 0.9375rem;
}
.project-box p { margin: 0; }
.project-box-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  row-gap: 0.25rem;
}
.label {
  margin-right: 0.75rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.project-box-name { color: var(--text-strong); font-weight: 650; }
.project-box-summary {
  margin-top: 0.35rem !important;
  color: var(--muted);
  line-height: 1.55;
}

.toc {
  margin: 0 0 2.25rem;
  font-size: 0.9375rem;
}
.toc summary {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  cursor: pointer;
  color: var(--text-strong);
  font-weight: 600;
  list-style: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::before {
  content: "";
  width: 0.45em;
  height: 0.45em;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-0.15em) rotate(-45deg);
  transition: transform 120ms ease;
}
.toc details[open] summary::before { transform: translateY(-0.3em) rotate(45deg); }
.toc summary:hover { color: var(--accent); }
.toc-count { color: var(--muted); font-weight: 400; }
.toc ol {
  margin: 0.75rem 0 0;
  padding: 0.1rem 0 0.1rem 2.1rem;
  border-left: 2px solid var(--border);
}
.toc li { margin: 0.3rem 0; }
.toc li::marker { color: var(--muted); font-family: var(--font-mono); font-size: 0.8125rem; }

.post-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1rem;
  margin-top: 4rem;
}
.post-nav-link {
  display: block;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-strong);
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
}
.post-nav-link:hover { border-color: var(--accent); color: var(--accent); }
.post-nav-newer { text-align: right; grid-column: -2; }
.post-nav-label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
}
.post-nav-older .post-nav-label::before { content: "← "; }
.post-nav-newer .post-nav-label::after { content: " →"; }

/* ---------- Prose ---------- */

.prose { max-width: var(--measure); line-height: 1.7; }
.prose > :first-child { margin-top: 0; }

.prose p,
.prose ul,
.prose ol,
.prose dl,
.prose blockquote,
.prose pre,
.prose table { margin: 0 0 1.25em; }

.prose h2 {
  margin: 2.4em 0 0.7em;
  font-size: 1.5em;
  letter-spacing: -0.02em;
}
.prose h3 {
  margin: 2em 0 0.5em;
  font-size: 1.2em;
}
.prose h4 {
  margin: 1.75em 0 0.5em;
  font-size: 1em;
}

.heading-anchor {
  margin-left: 0.35em;
  color: var(--border-strong);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
  transition: opacity 120ms ease;
}
.prose :is(h2, h3, h4):hover .heading-anchor,
.heading-anchor:focus-visible { opacity: 1; }
.heading-anchor:hover { color: var(--accent); }
@media (hover: none) {
  .heading-anchor { opacity: 1; }
}

.prose ul,
.prose ol { padding-left: 1.4em; }
.prose li { margin: 0.4em 0; }
.prose li > ul,
.prose li > ol { margin: 0.4em 0; }
.prose li::marker { color: var(--muted); }

.prose strong { color: var(--text-strong); font-weight: 650; }

.prose blockquote {
  margin-left: 0;
  padding: 0.1em 0 0.1em 1.2em;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
}
.prose blockquote > :last-child { margin-bottom: 0; }

.prose hr {
  height: 1px;
  margin: 3em 0;
  border: 0;
  background: var(--border);
}

.prose dl { display: grid; gap: 0.2em 1.5em; }
.prose dt { color: var(--text-strong); font-weight: 650; }
.prose dd { margin: 0 0 0.7em; color: var(--text); }
@media (min-width: 40em) {
  .prose dl { grid-template-columns: minmax(10rem, 14rem) 1fr; }
  .prose dd { margin: 0; }
  .prose dt, .prose dd { padding: 0.55em 0; border-top: 1px solid var(--border); }
}

.entry-meta {
  margin-top: -0.25em !important;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

/* Inline code */
.prose code,
.prose kbd {
  padding: 0.12em 0.36em;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.85em;
  overflow-wrap: anywhere;
}
.prose a code { color: inherit; }

/* Code blocks. Colours come from the giallo stylesheets; the background is replaced
   with the site's own code surface. Every token colour of both GitHub themes is at least
   4.5:1 against --code-bg (the lowest, light-mode comments, is 4.55:1 on white), so
   check that again before changing either the surface or the themes.
   Long lines scroll inside the block; current browsers make a scrolling block
   keyboard-focusable, so it can be read without a mouse. */
.prose pre {
  position: relative;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  font-size: 0.84rem;
  line-height: 1.6;
  overflow-x: auto;
  tab-size: 4;
}
@media (min-width: 48em) {
  .prose pre { font-size: 0.875rem; }
}
.prose pre.giallo { background-color: var(--code-bg); }
.prose pre code {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  font-size: 1em;
  overflow-wrap: normal;
  white-space: pre;
}
/* A label above each block: the file name if the fence gives one (```toml,name=zola.toml),
   otherwise the language. Plain text blocks go unlabelled. */
.prose pre code[data-lang]::before,
.prose pre code[data-name]::before {
  display: block;
  margin-bottom: 0.6rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}
.prose pre code[data-lang]::before { content: attr(data-lang); }
.prose pre code[data-lang="shellscript"]::before { content: "shell"; }
.prose pre code[data-name]::before { content: attr(data-name); }
.prose pre code[data-lang="text"]:not([data-name])::before,
.prose pre code[data-lang="txt"]:not([data-name])::before,
.prose pre code[data-lang="plain"]:not([data-name])::before { content: none; }

.giallo-l {
  display: inline-block;
  min-width: 100%;
  min-height: 1lh;
}
.giallo-ln {
  display: inline-block;
  min-width: 3ch;
  margin-right: 1em;
  text-align: right;
  opacity: 0.6;
  user-select: none;
}

/* Tables: a wide table scrolls inside itself instead of widening the page. */
.prose table {
  display: block;
  max-width: 100%;
  width: max-content;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9375em;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.prose th,
.prose td {
  padding: 0.55em 1em 0.55em 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.prose th:last-child,
.prose td:last-child { padding-right: 0; }
.prose th {
  border-bottom: 2px solid var(--border-strong);
  color: var(--text-strong);
  font-weight: 650;
}

/* Figures. The frame links to the full-size image, which matters for a wide diagram
   read on a phone. */
.figure { margin: 2.25em 0; }
.figure-frame {
  display: block;
  padding: clamp(0.75rem, 3vw, 1.5rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--figure-bg);
}
/* Figures are shown at their natural size, never wider than the space they have. There
   is deliberately no height cap: most diagrams here are tall top-down flowcharts, and
   shrinking one to fit a screen shrinks its labels below reading size. */
.figure img {
  display: block;
  margin-inline: auto;
}
/* A wide diagram shrinks to fit the column, and its labels shrink with it. On a large
   screen it may extend past the text on both sides, up to 60rem. */
@media (min-width: 64em) {
  .prose .figure-wide {
    --fig: min(60rem, 100vw - 6rem);
    width: var(--fig);
    margin-inline: calc((100% - var(--fig)) / 2);
  }
}
.figure figcaption {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.875em;
  line-height: 1.5;
}

/* Footnotes */
.footnote-reference { font-size: 0.75em; line-height: 0; }
.footnote-reference a { text-decoration: none; padding-inline: 0.1em; }
.footnotes {
  margin-top: 3.5em;
  padding-top: 1.25em;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875em;
}
.footnotes ol { padding-left: 1.4em; }
.footnotes li p { margin: 0 0 0.5em; }
.footnotes a[href^="#fr-"],
.footnotes li > p > a:last-child { text-decoration: none; }

/* ---------- Motion ---------- */

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

/* ---------- Print ---------- */

@media print {
  .site-header, .site-footer, .skip-link, .post-nav, .toc, .heading-anchor { display: none; }
  body { background: #fff; color: #000; }
  a { color: inherit; }
}
