/*
 * chrisbreuer.me - bare monochrome site styles (stx pages).
 * Mirrors content/blog/.theme.css so /blog and the stx pages read as one site.
 * Light and dark via [data-theme] on <html> (set pre-paint by /assets/scripts/theme.js,
 * which follows prefers-color-scheme until the visitor picks a mode).
 */

/* Lilex (OFL, https://github.com/mishamyrt/Lilex), the site's one typeface.
 * Variable weight 100-700, self-hosted, swap so text never blocks on it. */
@font-face {
  font-family: 'Lilex';
  src: url('/fonts/lilex/Lilex-var.9bf383fbcdf9.woff2') format('woff2');
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Lilex';
  src: url('/fonts/lilex/Lilex-Italic-var.dd49d80f9aca.woff2') format('woff2');
  font-weight: 100 700;
  font-style: italic;
  font-display: swap;
}

:root {
  --font-mono: 'Lilex', ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
}

:root,
:root[data-theme='light'] {
  --bg: #fafafa;
  --bg-soft: #f0f0f0;
  --text-1: #111111;
  --text-2: #444444;
  --text-3: #6b6b6b;
  --divider: #e4e4e4;
  --code-bg: #efefef;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0a0a0a;
  --bg-soft: #161616;
  --text-1: #ededed;
  --text-2: #a8a8a8;
  --text-3: #8a8a8a;
  --divider: #242424;
  --code-bg: #1a1a1a;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-1);
  background: var(--bg);
}

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

.shell {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

a { color: var(--text-1); }

a:focus-visible,
button:focus-visible { outline: 2px solid var(--text-1); outline-offset: 4px; }

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 1.25rem;
  z-index: 20;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ── Masthead ───────────────────────────────────────────────────────────── */
.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding: 1.5rem 0 0;
}
.masthead .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-1);
  text-decoration: none;
}
.masthead .brand img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: block;
}
.masthead nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.masthead nav a {
  color: var(--text-2);
  text-decoration: none;
}
.masthead nav a:hover,
.masthead nav a[aria-current='page'] {
  color: var(--text-1);
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* Round icon buttons at the end of the masthead: GitHub, then the theme toggle. */
.icon-btn {
  border: 1px solid var(--divider);
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
}
.icon-btn:hover { color: var(--text-1); border-color: var(--text-3); }
a.icon-btn { text-decoration: none; }
.icon-btn > [class^='i-'] { width: 15px; height: 15px; }
/* The buttons sit outside the nav: 1rem after it, as between its links, and
 * 0.5rem between the two buttons, rather than the masthead's 1.5rem. */
.masthead nav + .icon-btn { margin-left: -0.5rem; }
.masthead .icon-btn + .icon-btn { margin-left: -1rem; }
/* Phones: name and the buttons share the top row, the links take the next. */
@media (max-width: 640px) {
  .masthead { row-gap: 0.9rem; }
  .masthead .icon-btn { order: 2; }
  .masthead nav + .icon-btn { margin-left: auto; }
  .masthead nav { order: 3; width: 100%; margin-left: 0; }
}

/* ── Page basics ────────────────────────────────────────────────────────── */
main { padding: 3.5rem 0 2rem; }

.page-title {
  margin: 0 0 1rem;
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.18;
}
/* Stacks the home headline one clause per line at desktop; mobile wraps naturally. */
.title-break { display: none; }
@media (min-width: 640px) {
  .title-break { display: inline; }
}

.page-lead {
  margin: 0 0 2.5rem;
  max-width: 38rem;
  color: var(--text-2);
}

.home-lead { margin-bottom: 1.25rem; }
.home-links { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; margin-bottom: 2.5rem; font-size: 0.85rem; }
.home-links a { text-underline-offset: 4px; }
.post-deck { margin: 0 0 1rem; color: var(--text-2); }
.post-navigation { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; border-top: 1px solid var(--divider); padding-top: 1.25rem; margin-top: 2.5rem; }
.post-navigation a { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; text-decoration: none; }
.post-navigation a:hover > span:last-child { text-decoration: underline; text-underline-offset: 3px; }
.post-nav-label { font-size: 0.75rem; color: var(--text-3); }
.page-lead a,
.prose a,
.project-intro a,
.entry-list .entry-desc a {
  color: var(--text-1);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--text-3);
}
.page-lead a:hover,
.prose a:hover,
.project-intro a:hover,
.entry-list .entry-desc a:hover { text-decoration-color: var(--text-1); }

.prose p { margin: 0 0 1.1rem; color: var(--text-2); }
.prose strong { color: var(--text-1); }

/* ── Blog post ──────────────────────────────────────────────────────────── */
.post { max-width: 40rem; }
.post-back {
  display: inline-block;
  margin-bottom: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-3);
  text-decoration: none;
}
.post-back:hover { color: var(--text-1); }
.post-meta {
  margin: 0.4rem 0 2rem;
  font-size: 0.8rem;
  color: var(--text-3);
}
.post-body { font-size: 1rem; line-height: 1.75; }
.post-body h2 { margin: 2.2rem 0 0.75rem; font-size: 1.3rem; font-weight: 650; letter-spacing: -0.01em; }
.post-body h3 { margin: 1.8rem 0 0.5rem; font-size: 1.1rem; font-weight: 600; }
.post-body ul, .post-body ol { margin: 0 0 1.1rem; padding-left: 1.4rem; color: var(--text-2); }
.post-body li { margin: 0.3rem 0; }
.post-body pre {
  margin: 0 0 1.3rem;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--divider);
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.6;
}
.post-body :not(pre) > code {
  padding: 0.1rem 0.35rem;
  background: var(--code-bg);
  border-radius: 4px;
  font-size: 0.88em;
}
.post-body img { max-width: 100%; height: auto; border-radius: 8px; }
/* Figures, grids, zoom and embeds come from @stacksjs/cms/article (styles
   inlined by the post view); these tune them to the site. */
.post-body {
  --me-radius: 8px;
  --me-gap: 6px;
  --me-block-space: 1.8rem;
  --me-caption-color: var(--text-3);
  --me-zoom-backdrop: var(--bg);
}
.post-body figcaption { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.01em; }
.post-body blockquote {
  margin: 0 0 1.2rem;
  padding-left: 1rem;
  border-left: 2px solid var(--divider);
  color: var(--text-3);
}

/* ── Comments ───────────────────────────────────────────────────────────── */
.comments {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--divider);
}
.comments h2 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.comment-list { list-style: none; margin: 0 0 2rem; padding: 0; }
.comment {
  padding: 1rem 0;
  border-top: 1px solid var(--divider);
}
.comment:first-child { border-top: 0; padding-top: 0; }
/* The anchor a posted comment lands on: a brief tint so the eye finds it. */
.comment:target { animation: comment-arrive 2.4s ease-out; }
@keyframes comment-arrive {
  from { background: var(--bg-soft); }
  to { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .comment:target { animation: none; }
}
.comment-meta {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  color: var(--text-3);
}
.comment-author { font-weight: 600; color: var(--text-1); }
.comment-body {
  margin: 0;
  color: var(--text-2);
  line-height: 1.65;
  /* Keep the reader's line breaks; the text itself is escaped. */
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.comment-empty { margin: 0 0 2rem; color: var(--text-3); font-size: 0.95rem; }
.comment-note {
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-2);
}
.comment-note.is-error { color: var(--text-1); }

.comment-form h3 {
  margin: 0 0 0.9rem;
  font-size: 0.95rem;
  font-weight: 650;
}
.comment-form label { display: block; margin-bottom: 0.8rem; }
.comment-form label > span {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
}
.comment-form label small { font-weight: 400; color: var(--text-3); }
.comment-fields { display: grid; gap: 0 0.8rem; }
@media (min-width: 640px) {
  .comment-fields { grid-template-columns: 1fr 1fr; }
}
.comment-form input,
.comment-form textarea {
  display: block;
  width: 100%;
  padding: 0.55rem 0.8rem;
  font: inherit;
  /* 16px floor: anything smaller makes iOS Safari zoom the page on focus */
  font-size: 1rem;
  color: var(--text-1);
  background: var(--bg);
  border: 1px solid var(--divider);
  border-radius: 6px;
}
.comment-form textarea { resize: vertical; min-height: 7.5rem; line-height: 1.6; }
.comment-form input:focus,
.comment-form textarea:focus {
  outline: 2px solid var(--text-1);
  outline-offset: 1px;
  border-color: var(--text-1);
}
/* Off-screen rather than display:none, which some bots skip filling in. */
.comment-form .comment-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.comment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
}
.comment-actions button {
  padding: 0.55rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--text-1);
  border: 1px solid var(--text-1);
  border-radius: 6px;
  cursor: pointer;
}
.comment-actions button:hover { opacity: 0.85; }
.comment-actions button:active { transform: translateY(1px); }
.comment-hint { margin: 0; font-size: 0.8rem; color: var(--text-3); }

.section-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 2.75rem 0 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.section-label a {
  color: var(--text-3);
  text-decoration: none;
}
.section-label a:hover {
  color: var(--text-1);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.section-label .label-meta {
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-3);
  opacity: 0.75;
}

/* ── Post list (home) ───────────────────────────────────────────────────── */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li { border-top: 1px solid var(--divider); }
.post-list li:first-child { border-top: 0; }
.post-list a {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  justify-content: space-between;
  padding: 0.8rem 0;
  text-decoration: none;
  color: var(--text-1);
}
.post-list .post-title { margin: 0; font-size: inherit; font-weight: 550; line-height: 1.4; }
.post-list .post-excerpt { margin: 0.25rem 0; color: var(--text-2); font-size: 0.85rem; line-height: 1.65; }
.post-index .post-title { font-size: 1.1rem; }
.post-index a { padding: 1.25rem 0; }
/* Reading stats sit under the title, on /blog and on the home page. */
.post-list .post-main { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.post-list .post-stats {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-3);
}
.post-list a:hover .post-title { text-decoration: underline; text-underline-offset: 3px; }
.post-list .post-date {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-3);
}

/* ── Row list (projects, work) ──────────────────────────────────────────── */
.entry-list { list-style: none; margin: 0; padding: 0; }
.entry-list li {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 0.35rem 1.5rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--divider);
}
.entry-list li:first-child { border-top: 0; }
.entry-list .entry-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
}
.entry-list .entry-name a { text-decoration: none; }
.entry-list .entry-name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.entry-list .entry-desc { color: var(--text-2); font-size: 0.95rem; line-height: 1.55; }
.entry-list .entry-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-3);
}

@media (max-width: 640px) {
  .entry-list li { grid-template-columns: 1fr; gap: 0.15rem; }
  .post-list a { flex-direction: column; gap: 0.25rem; }
  .post-navigation { grid-template-columns: 1fr; }
}

.empty-note {
  margin: 0;
  max-width: 38rem;
  color: var(--text-2);
  font-size: 0.98rem;
  line-height: 1.65;
}
/* A note closing a list (/goals) needs room to read as its own paragraph,
   not as a wrapped line of the last row. */
.entry-list + .empty-note { margin-top: 2rem; }

/* Goal progress (/goals): the same hairline as every divider, with the done
 * part drawn over it in the text colour. The label says it in words, so the
 * bar is never the only way to read the number. */
.goal-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
  max-width: 32rem;
}
.goal-bar {
  position: relative;
  flex: 1;
  height: 3px;
  background: var(--divider);
  overflow: hidden;
}
.goal-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--text-1);
}
.goal-bar-label {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-3);
  white-space: nowrap;
}

/* ── Pull quote ─────────────────────────────────────────────────────────── */
/* Same hairline vocabulary as every other divider on the site: the quote is
 * set off by a rule rather than by a bigger, louder typeface. */
.pull-quote {
  margin: 0 0 2.5rem;
  padding: 0.1rem 0 0.1rem 1.25rem;
  border-left: 2px solid var(--divider);
  max-width: 38rem;
}
.pull-quote p {
  margin: 0;
  color: var(--text-1);
  font-size: 1.02rem;
  line-height: 1.6;
  text-wrap: pretty;
}
.pull-quote footer {
  margin-top: 0.55rem;
  font-size: 0.8rem;
  color: var(--text-3);
}

/* ── Subscribe ──────────────────────────────────────────────────────────── */
.subscribe {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--divider);
}
.subscribe h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.subscribe p {
  margin: 0 0 1rem;
  color: var(--text-2);
  font-size: 0.95rem;
}
.subscribe form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.subscribe input[type='email'] {
  flex: 1 1 14rem;
  min-width: 0;
  padding: 0.55rem 0.8rem;
  font: inherit;
  /* 16px floor: anything smaller makes iOS Safari zoom the page on focus */
  font-size: 1rem;
  color: var(--text-1);
  background: var(--bg);
  border: 1px solid var(--divider);
  border-radius: 6px;
}
.subscribe input[type='email']::placeholder { color: var(--text-3); }
.subscribe input[type='email']:focus {
  outline: 2px solid var(--text-1);
  outline-offset: 1px;
  border-color: var(--text-1);
}
.subscribe button {
  padding: 0.55rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--text-1);
  border: 1px solid var(--text-1);
  border-radius: 6px;
  cursor: pointer;
}
.subscribe button:hover { opacity: 0.85; }
.subscribe button:active { transform: translateY(1px); }
.subscribe .form-note {
  width: 100%;
  margin: 0.2rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-2);
  min-height: 1.2em;
}

/* ── Navigation progress ─────────────────────────────────────────────── */
/* The router's bar, in the site's own ink rather than its default cyan glow.
 * `html >` outranks the rule the router injects at runtime (it lands after
 * this file), and the colour comes from the theme tokens, so it is black on
 * light and near-white on dark. The option for it takes a literal colour
 * only; a var() would be stripped. */
html > #stx-router-progress {
  background: var(--text-1);
  box-shadow: none;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
/* The rule above the footer is a ridgeline (see partials/footer.stx): same
 * hairline weight and colour as every other divider, it just isn't flat. The
 * height is what makes a real elevation profile legible, the San Gabriels run
 * 2,100 to 9,700 ft, and under ~2.5rem that range flattens into a wobble. */
.ridge-wrap {
  position: relative;
  margin-top: 3.5rem;
  /* The peak labels hang off the line; never let one make the page scroll
   * sideways (it did on phones: a label past the right edge added 18px). */
  overflow-x: clip;
}

.ridge {
  display: block;
  width: 100%;
  height: 2.75rem;
  fill: none;
  stroke: var(--divider);
  stroke-width: 1;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

/* Hovering the ridge names the feature under the pointer. The zones tile the
 * whole line rather than sitting on the summits, so there is nowhere on it
 * that answers nothing; `--at` is where the peak falls inside its own zone,
 * which is not the middle, because the peaks are not evenly spaced. */
.ridge-peaks {
  position: absolute;
  inset: 0;
  /* A touch screen has no pointer to follow the line with, so the zones are
   * not there to be tapped at. */
  pointer-events: none;
}
.ridge-peak {
  position: absolute;
  top: 0;
  bottom: 0;
}
/* A hairline dropped on the summit itself, so the label is anchored to a
 * point on the line and not just floating near it. */
.ridge-peak::after {
  content: '';
  position: absolute;
  left: var(--at);
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--divider);
  opacity: 0;
  transition: opacity 0.12s ease;
}
.ridge-peak-name {
  /* Only a fine pointer can hover the line, so only it gets the labels;
   * elsewhere they would be invisible boxes taking up layout. */
  display: none;
  position: absolute;
  bottom: calc(100% - 0.35rem);
  left: var(--at);
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.ridge-peak-ft {
  color: var(--text-3);
}
/* The two at the ends would hang off the page if they were centred. */
.ridge-peak.is-start .ridge-peak-name {
  left: 0;
  transform: none;
}
.ridge-peak.is-end .ridge-peak-name {
  left: auto;
  right: 0;
  transform: none;
}
.ridge-peak:hover::after,
.ridge-peak:hover .ridge-peak-name {
  opacity: 1;
}
/* After the base rules on purpose: same specificity, so this has to come
 * later to win. Above them, `display: none` hid the labels everywhere. */
@media (hover: hover) and (pointer: fine) {
  .ridge-peaks {
    pointer-events: auto;
  }
  .ridge-peak-name {
    display: block;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ridge-peak::after,
  .ridge-peak-name {
    transition: none;
  }
}

.site-footer {
  padding: 1.25rem 0 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-3);
}
.site-footer a {
  color: var(--text-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.site-footer a:hover { color: var(--text-1); }
.site-footer .spacer { margin-left: auto; }

/* ── Projects filter ────────────────────────────────────────────────────── */
.proj-filter { margin: 1.4rem 0 2rem; }
.proj-search {
  display: block;
  width: 100%;
  max-width: 24rem;
  font: inherit;
  color: var(--text-1);
  background: var(--bg-soft);
  border: 1px solid var(--divider);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  margin-bottom: 1.6rem;
}
.proj-search::placeholder { color: var(--text-3); }
.proj-search:focus { outline: none; border-color: var(--text-3); }
.proj-facets { display: flex; flex-direction: column; gap: 0.55rem; }
.proj-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.proj-chip {
  font: inherit;
  font-size: 0.78rem;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--divider);
  border-radius: 999px;
  padding: 0.22rem 0.7rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.proj-chip:hover { color: var(--text-1); border-color: var(--text-3); }
.proj-chip.is-active {
  color: var(--bg);
  background: var(--text-1);
  border-color: var(--text-1);
}
.proj-empty { color: var(--text-3); margin: 0.5rem 0 1.5rem; }

/* ── About page ─────────────────────────────────────────────────────────── */
/* One masonry wraps around the bio and portrait. The bio sits top-left over
 * three columns, the portrait top-right over two; the 46 photos flow through a
 * single 5-column masonry whose left three columns start below the bio and
 * whose right two start below the portrait, so the right side runs unbroken
 * to the bottom and the left three fill in beside it, one seamless grid. The
 * geometry (column widths, x/y of every tile, container height) is computed in
 * /assets/scripts/gallery.js; the rules below are just the paint + a graceful
 * pre-JS / no-JS fallback (bio, portrait, then a plain multi-column masonry). */
.about-wrap { position: relative; }
.bio-col { min-width: 0; }
.portrait-col > img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--divider);
  display: block;
}
.portrait-note {
  margin: 0.9rem 0 0;
  color: var(--text-3);
  font-size: 0.85rem;
  line-height: 1.55;
  text-wrap: balance;
}

.photo-masonry {
  margin-top: 1.5rem;
  column-count: 3;
  column-gap: 0.5rem;
}
/* When JS takes over it sets .is-laid-out and positions every tile absolutely;
 * the container then owns its height and the columns/gap above are inert. */
.photo-masonry.is-laid-out {
  column-count: initial;
  margin-top: 0;
}
.photo-masonry.is-laid-out .gallery-item { position: absolute; top: 0; left: 0; margin: 0; }

@media (max-width: 480px) {
  .photo-masonry { column-count: 2; }
}

.gallery-item {
  display: block;
  width: 100%;
  margin: 0 0 0.5rem;
  padding: 0;
  border: 1px solid var(--divider);
  border-radius: 6px;
  overflow: hidden;
  break-inside: avoid;
  cursor: zoom-in;
  background-color: var(--bg-soft);
  background-size: cover;
  background-position: center;
  /* SplatHash placeholder is a 32px source; smooth it while it stands in. */
  image-rendering: auto;
  line-height: 0;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
}
.gallery-item:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); }
.gallery-item:focus-visible { outline: 2px solid var(--text-1); outline-offset: 2px; }
.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.gallery-item.is-loaded img { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .gallery-item, .gallery-item img { transition: none; }
  .gallery-item:hover { transform: none; }
}

/* ── Lightbox (Medium-style zoom) ────────────────────────────────────────── */
body.lightbox-open { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
/* Figure stacks the photo and its caption; the stage inside is what scales. */
.lightbox-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  max-width: 100%;
  max-height: 100%;
}
.lightbox-stage {
  display: block;
  position: relative;
  margin: 0;
  max-width: min(100%, 1400px);
  max-height: 100%;
  transform: scale(0.96);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
.lightbox.is-open .lightbox-stage { transform: scale(1); }
.lightbox-stage img {
  display: block;
  border-radius: 8px;
  cursor: zoom-out;
}
/* Both layers fill the stage, which is sized to the photo's aspect ratio in
   JS. The base is the masonry thumbnail scaled up: blurry for a moment, and
   the right shape, so nothing moves when the full-size layer lands on top. */
.lightbox-stage .lb-base {
  width: 100%;
  height: 100%;
  object-fit: cover;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
/* Full = the large photo, overlaid exactly on the base and faded in on load. */
.lightbox-stage .lb-full {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.lightbox-stage .lb-full.is-shown { opacity: 1; }
.lightbox-close {
  position: absolute;
  top: clamp(0.6rem, 2vw, 1.2rem);
  right: clamp(0.6rem, 2vw, 1.2rem);
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-1);
  background: var(--bg);
  border: 1px solid var(--divider);
  border-radius: 999px;
  cursor: pointer;
}
.lightbox-close:hover { background: var(--bg-soft); }

/* Where the photo was taken. Sized like the site's other meta text, and it
   arrives with the photo rather than after it, so opening one reads as a
   caption rather than as something loading in late. */
.lightbox-caption {
  max-width: min(100%, 68ch);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-3);
  text-align: center;
  text-wrap: pretty;
  cursor: zoom-out;
}
.lightbox-caption[hidden] { display: none; }

/* A full-size photo is about a megabyte, so the wait gets a mark. It sits over
   the thumbnail that is already on screen, which is why it is this quiet. */
.lb-spinner {
  position: absolute;
  left: 50%;
  bottom: 0.75rem;
  width: 1.1rem;
  height: 1.1rem;
  margin-left: -0.55rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
/* Only after a beat: a photo already in cache should not flash a spinner. */
.lightbox-stage.is-loading .lb-spinner {
  opacity: 1;
  transition-delay: 0.35s;
  animation: lb-spin 0.7s linear infinite;
}
@keyframes lb-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .lightbox, .lightbox-stage { transition: opacity 0.2s ease; }
  .lightbox-stage { transform: none; }
  .lightbox-stage .lb-full { transition: none; }
  .lightbox-stage.is-loading .lb-spinner { animation: none; }
}

/* --- /wip: two contribution graphs, drawn as GitHub draws them ------------
 * GitHub's own measurements and Primer colours (github.com, Sept 2026), in
 * both themes. The GitHub graph is green with GitHub's blue year list; the
 * HQ.training one (<hq-activity-chart>, styled through its custom
 * properties) is HQ blue, with #114CFE as level 3. Sans-serif on purpose:
 * this is GitHub's UI, not the site's. */
.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;
}
.wip-graph {
  --gh-text: #1f2328;
  --gh-muted: #59636e;
  --gh-border: #d1d9e0;
  --gh-accent: #0969da;
  --gh-hover: rgba(129, 139, 152, 0.12);
  --gh-edge: rgba(31, 35, 40, 0.05);
  --gh-tip: #25292e;
  --gh-l0: #eff2f5;
  --gh-l1: #aceebb;
  --gh-l2: #4ac26b;
  --gh-l3: #2da44e;
  --gh-l4: #116329;
  /* Wider than the text column: GitHub's graph is 723px before its year list. */
  width: min(calc(100vw - 2rem), 56rem);
  margin: 0 0 2.5rem calc(50% - min(calc(50vw - 1rem), 28rem));
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  line-height: 1.5;
}
:root[data-theme='dark'] .wip-graph {
  --gh-text: #f0f6fc;
  --gh-muted: #9198a1;
  --gh-border: #3d444d;
  --gh-accent: #1f6feb;
  --gh-edge: rgba(1, 4, 9, 0.05);
  --gh-tip: #3d444d;
  --gh-l0: #151b23;
  --gh-l1: #033a16;
  --gh-l2: #196c2e;
  --gh-l3: #2ea043;
  --gh-l4: #56d364;
}
.wip-graph hq-activity-chart {
  --hq-activity-text: var(--gh-text);
  --hq-activity-muted: var(--gh-muted);
  --hq-activity-border: var(--gh-border);
  --hq-activity-edge: var(--gh-edge);
  --hq-activity-l0: var(--gh-l0);
  --hq-activity-l1: #c9dbff;
  --hq-activity-l2: #719eff;
  --hq-activity-l3: #114cfe;
  --hq-activity-l4: #0229b1;
}
:root[data-theme='dark'] .wip-graph hq-activity-chart {
  --hq-activity-l1: #0b2466;
  --hq-activity-l2: #0f38aa;
  --hq-activity-l3: #114cfe;
  --hq-activity-l4: #76a2ff;
}
/* <hq-weight-chart>: drawn at its element's width, so it is held to the
   activity chart's (GitHub's 757px box) and centred with it. Same text and
   frame colours as both graphs; theme="class" follows data-theme for the
   rest. The whole section waits for the first weigh-in (hide-empty). */
.wip-graph hq-weight-chart {
  max-width: 757px;
  margin-inline: auto;
  --hq-weight-text: var(--gh-text);
  --hq-weight-muted: var(--gh-muted);
  --hq-weight-border: var(--gh-border);
}
.wip-weight:has(hq-weight-chart[hidden]) { display: none; }

/* The Apple Music player: Apple's own size (450px tall, at most 660px wide),
   rounded like its artwork, on the soft background while it loads. */
.wip-playlist iframe {
  display: block;
  width: 100%;
  max-width: 660px;
  height: 450px;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-soft);
}

/* Sized to the graph and centred in the wide band, like the HQ chart
   (align="center"), still scrolling when the band is narrower. */
.gh-contrib {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  color: var(--gh-text);
}
.gh-main { flex: 1 1 auto; min-width: 0; }
.gh-heading {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--gh-text);
}
.gh-box {
  /* Its natural width, like the HQ chart's, so the two frames line up. */
  width: max-content;
  max-width: 100%;
  border: 1px solid var(--gh-border);
  border-radius: 6px;
  /* 161px tall in all, as on github.com and in the HQ chart's SVG. The
     bottom padding is the scroller's, so a scrollbar runs along the box's
     edge, as the HQ chart's does, not across the legend. */
  padding: 12px 0 0;
}
.gh-scroll { overflow-x: auto; overflow-y: hidden; padding: 0 16px 12px; }
/* A year on its way (site.js swaps it in): the old graph stays, dimmed. */
.gh-box { transition: opacity 0.15s; }
.gh-contrib[aria-busy='true'] .gh-box { opacity: 0.5; }
.gh-grid {
  position: relative;
  border-collapse: separate;
  border-spacing: 3px;
  font-size: 12px;
  line-height: 18px;
}
.gh-grid td { padding: 0; }
.gh-grid thead td { height: 13px; }
.gh-label-col { position: relative; width: 28px; min-width: 28px; }
.gh-month { position: relative; }
/* Placed as github.com places them: month names 18px and "Mon" 45px below
   the box's top edge, with the first row of squares at 35px. */
.gh-month span,
.gh-weekday {
  position: absolute;
  left: 0;
  white-space: nowrap;
  color: var(--gh-text);
}
.gh-month span { top: 0; }
.gh-weekday { top: -5px; }
.gh-day {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--gh-l0);
  outline: 1px solid var(--gh-edge);
  outline-offset: -1px;
}
.gh-day[data-level='1'] { background: var(--gh-l1); }
.gh-day[data-level='2'] { background: var(--gh-l2); }
.gh-day[data-level='3'] { background: var(--gh-l3); }
.gh-day[data-level='4'] { background: var(--gh-l4); }
/* Primer's tooltip, in CSS: below the day for the top rows and pinned to the
 * ends of the graph, so it never leaves the scroller. */
.gh-day[data-tip]:hover { outline-color: var(--gh-muted); }
.gh-day[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 5;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--gh-tip);
  color: #ffffff;
  font-size: 12px;
  line-height: 1.625;
  white-space: nowrap;
  pointer-events: none;
}
.gh-day[data-below]:hover::after { top: calc(100% + 4px); bottom: auto; }
.gh-day[data-edge='start']:hover::after { left: 0; transform: none; }
.gh-day[data-edge='end']:hover::after { left: auto; right: 0; transform: none; }
.gh-canvas { width: max-content; margin: 0 auto; }
/* Spans the squares, not the weekday column, like GitHub's. */
.gh-footer {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  padding: 0 3px 0 34px;
  font-size: 12px;
  color: var(--gh-muted);
}
.gh-footer a { color: var(--gh-muted); text-decoration: none; }
.gh-footer a:hover { color: var(--gh-accent); text-decoration: underline; }
.gh-legend { display: inline-flex; align-items: center; gap: 4px; }
.gh-legend .gh-day { display: inline-block; }
.gh-years {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gh-years a {
  display: block;
  min-width: 72px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 18px;
  color: var(--gh-muted);
  text-decoration: none;
}
.gh-years a:hover { background: var(--gh-hover); color: var(--gh-text); }
.gh-years a[aria-current] { background: var(--gh-accent); color: #ffffff; }
@media (max-width: 860px) {
  /* Stacked, the graph takes the column's width and scrolls inside it. */
  .gh-contrib { flex-direction: column-reverse; align-items: stretch; }
  .gh-years { flex-direction: row; flex-wrap: wrap; }
}
/* Years on top at every width: a row of compact tabs above the graph, so the
   whole thing is only as wide as the graph (the /wip page's yearsPosition). */
.gh-contrib--years-top { flex-direction: column-reverse; align-items: stretch; gap: 8px; }
.gh-contrib--years-top .gh-years { flex-direction: row; flex-wrap: wrap; gap: 4px; }
.gh-contrib--years-top .gh-years a { min-width: 0; padding: 2px 10px; }
/* On a touchscreen the tabs are GitHub's full 34px height, big enough to hit. */
@media (pointer: coarse) {
  .gh-contrib--years-top .gh-years a { padding: 8px 12px; }
}

/* ── Project pages (/stacks, /home) ─────────────────────────────────────── */
/* The project's own links, under the lead: site, docs, source. */
.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: -1.25rem 0 2.25rem;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
}
.project-links a {
  color: var(--text-1);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--text-3);
}
.project-links a:hover { text-decoration-color: var(--text-1); }
/* Sections are long, so each opens with a sentence of context before its rows. */
.project-intro { margin: 0 0 0.5rem; max-width: 38rem; color: var(--text-2); font-size: 0.95rem; }
/* Commands and code, the same block the blog uses. */
.snippet {
  margin: 0.75rem 0 1.5rem;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--divider);
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-1);
}
.entry-list .entry-desc code,
.project-intro code {
  padding: 0.05rem 0.3rem;
  background: var(--code-bg);
  border-radius: 4px;
  font-size: 0.88em;
  white-space: nowrap;
}
