/* Rangefinder: a quiet, premium theme after the classic rangefinder
   camera. Light or dark, a clean sans with engraved-looking small
   capitals, hairline rules, and one spot of color: the highlight, used as
   sparingly as the red dot on the camera's front. The alternate color is
   the second, quieter material.

   Reading comes first: body text is regular weight at 18px, gray text
   keeps at least 6:1 contrast, and only large headlines go light. */

:root {
  --highlight: var(--setting-highlight, #d50c1d);
  --alternate: var(--setting-alternate, #2c3338);
  --on-alternate: #f4f3f0;

  /* What the platform's stylesheets (image layouts, lightbox) read. */
  --ink: #1b1b1c;
  --paper: #fbfbf9;
  --muted: #55585c;
  --rule: #dddcd8;
  /* The system UI faces (SF Pro, Segoe UI, Roboto) are drawn for reading
     on screens; Helvetica Neue is the fallback. */
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --measure: var(--setting-text_width, 38rem);
  --wide: 68rem;

  --gutter: clamp(1.25rem, 5vw, 4rem);
  --surface: #f1f0ec;
  /* Side padding that lines the header and footer up with the content. */
  --edge: max(var(--gutter), calc((100% - var(--wide)) / 2));
}


/* Dark appearance: the alternate color is lifted so it still reads on
   black. Automatic follows the reader's device. */
.setting-appearance-dark {
  --ink: #e8e7e3;
  --paper: #111112;
  --muted: #a5a7ab;
  --rule: #2e2f31;
  --surface: #1c1d1e;
  --alternate: color-mix(in srgb, var(--setting-alternate, #2c3338) 70%, #5a5f63);
}
@media (prefers-color-scheme: dark) {
  .setting-appearance-auto {
    --ink: #e8e7e3;
    --paper: #111112;
    --muted: #a5a7ab;
    --rule: #2e2f31;
    --surface: #1c1d1e;
    --alternate: color-mix(in srgb, var(--setting-alternate, #2c3338) 70%, #5a5f63);
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.125rem/1.65 var(--sans);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--highlight); }

/* The engraved label style: small, spaced capitals. */
.rf-nav a,
.rf-date,
.rf-tagline,
.rf-edit,
.rf-footer,
.article-body h4,
.article-body th {
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rf-dot {
  flex: none;
  display: inline-block;
  width: 0.62em;
  height: 0.62em;
  border-radius: 50%;
  background: var(--highlight);
}

/* Header: the name with its dot on the left, the menu on the right, a
   hairline below, and the tagline under it. */
.rf-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: calc(0.5rem * (1 - var(--shrink))) 2rem;
  padding: calc(1.75rem - 1rem * var(--shrink)) var(--edge) calc(1.5rem - 0.9rem * var(--shrink));
  /* Clear of the platform's owner's bar or sign-in. */
  padding-right: calc(var(--edge) + var(--owner-bar-space, 0px));
  /* A faint hairline under the header. */
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 60%, transparent);
  background: var(--paper);
}
/* The header settings: it stays at the top while the page scrolls, and
   then may shrink and fade. */
.setting-header_sticky-true .rf-header {
  position: sticky;
  top: 0;
  z-index: 20;
}
/* As the page scrolls down its first 8rem, a header that stays at the
   top shrinks a little (--shrink) and its contents fade (--fade), each
   going from 0 to 1 driven by the scroll itself, without a script; the
   pointer over it brings them back. Either can be turned off. Where
   browsers can't drive it by scroll, the header stays as it is. */
@property --shrink {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@property --fade {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@keyframes header-shrink { to { --shrink: 1; --fade: 1; } }
@supports (animation-timeline: scroll()) {
  .setting-header_sticky-true .rf-header {
    animation: header-shrink linear both;
    animation-timeline: scroll(root);
    animation-range: 0 8rem;
  }
}
/* Below a header that stays at the top, a faint fade, so text scrolling
   up goes soft just before it slips under it. */
.setting-header_sticky-true .rf-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 1.25rem;
  background: linear-gradient(color-mix(in srgb, var(--paper) 70%, transparent), transparent);
  pointer-events: none;
}
.setting-header_shrink-false .rf-header { --shrink: 0 !important; }
.setting-header_fade-false .rf-header { --fade: 0 !important; }
.rf-header > * { opacity: calc(1 - 0.35 * var(--fade)); transition: opacity 0.2s; }
.rf-header:hover > *,
.rf-header:focus-within > * { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .rf-header { animation: none; }
}

.rf-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  font-size: calc(1.35rem * (1 - 0.15 * var(--shrink)));
  font-weight: 600;
  letter-spacing: -0.01em;
}
.rf-brand:hover { color: inherit; }
.rf-title { overflow-wrap: anywhere; }
.rf-tagline {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  /* It folds away as the header shrinks. */
  max-height: calc(2rem * (1 - var(--shrink)));
  overflow: hidden;
}
.rf-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.rf-nav a { color: var(--muted); }
.rf-nav a:hover { color: var(--ink); }
.rf-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -1px 0 var(--highlight); }

.rf-main {
  flex: 1;
  width: 100%;
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 5.5rem) var(--gutter) 5rem;
}

/* Front page: the platform's (front.css lays it out); Rangefinder gives
   it its look. The lead is centred, large and light, the pins beside it are quiet,
   and the posts by date are an index on hairlines: each has its title
   and excerpt, and its date. */
.rangefinder {
  --accent: var(--highlight);
  --serif-display: var(--sans);
}
.rangefinder .front-top { border-bottom-color: var(--ink); }
.rangefinder .front-lead { text-align: center; }
.rangefinder .front-lead-label { color: var(--highlight); font-family: var(--mono); font-weight: 500; letter-spacing: 0.08em; }
.rangefinder .front-lead-headline {
  font-size: clamp(2.2rem, 5.5vw, 4rem);
  font-weight: 300;
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.rangefinder .front-lead-dek { font-size: 1.25rem; line-height: 1.5; text-wrap: pretty; }
.rangefinder .front-pin-headline { font-size: 1.1rem; font-weight: 500; letter-spacing: -0.01em; }
.rangefinder .front-pin-image img { border-radius: 1px; }

.rangefinder .front-story {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "headline date" "dek .";
  column-gap: 1.25rem;
  align-items: baseline;
  padding: 1.5rem 0;
}
.rangefinder .front-story-headline {
  grid-area: headline;
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.rangefinder .front-story-dek { grid-area: dek; margin-top: 0.45rem; font-size: 1.0625rem; line-height: 1.55; text-wrap: pretty; }
.rangefinder .front-story .front-date { grid-area: date; margin: 0; text-align: right; }
.rangefinder .front-date { font-weight: 600; }
.rangefinder .front-lead .front-date { color: var(--highlight); }

.rangefinder .front-year > h2 {
  border-bottom-width: 1px;
  font-size: clamp(2.6rem, 6vw, 3.6rem);
  font-weight: 200;
  letter-spacing: -0.04em;
}
.rangefinder .front-month > h3 { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.2em; color: var(--ink); }
.rangefinder .front-month > h3::after { border-top-color: var(--rule); }
.rangefinder .front-month > h3::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--highlight);
}

@media (max-width: 40rem) {
  .rangefinder .front-story {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "headline" "dek" "date";
    row-gap: 0.4rem;
  }
  .rangefinder .front-story .front-date { text-align: left; }
}

/* Post */
.rf-article-header {
  max-width: var(--wide);
  margin: 0 auto clamp(2.5rem, 6vw, 4.5rem);
}
.rf-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin: 0 0 1.25rem;
}
.rf-meta .rf-date { color: var(--highlight); }
.rf-edit {
  padding: 0.25rem 0.8rem;
  border: 1px solid var(--rule);
  color: var(--muted);
}
.rf-edit:hover { border-color: var(--highlight); }
.rf-headline {
  max-width: 22ch;
  margin: 0;
  font-size: clamp(2.4rem, 6.5vw, 4.5rem);
  font-weight: 300;
  line-height: 1.08;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.rf-dek {
  max-width: var(--measure);
  margin: 1.5rem 0 0;
  font-size: 1.3rem;
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
}

.article-body > .block {
  max-width: var(--measure);
  margin: 0 auto;
}
.article-body p { margin: 0 0 1.25em; text-wrap: pretty; }
.article-body strong { font-weight: 650; }
.article-body h2,
.article-body h3,
.article-body h4 {
  clear: both;
  margin: 2.2em 0 0.6em;
  line-height: 1.25;
  text-wrap: balance;
}
.article-body h2 { font-size: 1.65rem; font-weight: 500; letter-spacing: -0.02em; }
.article-body h3 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
.article-body h4 { color: var(--muted); }
.article-body a {
  text-decoration: underline;
  text-decoration-color: var(--highlight);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
.article-body ul,
.article-body ol { margin: 0 0 1.4em; padding-left: 1.3em; }
.article-body li { margin: 0.3em 0; }
.article-body li::marker { color: var(--muted); }
.article-body blockquote {
  margin: 2em 0;
  padding: 0 0 0 1.5rem;
  border-left: 2px solid var(--alternate);
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--ink);
}
.article-body hr {
  width: 3rem;
  margin: 3em auto;
  border: 0;
  border-top: 1px solid var(--highlight);
}
.article-body code {
  padding: 0.1em 0.35em;
  background: var(--surface);
  border-radius: 2px;
  font: 0.86em var(--mono);
}

/* Tables: hairlines, with the heading row in the alternate color. */
.article-body > .block-table { margin: 0 auto 1.8em; }
.article-body > .block-width-text { max-width: var(--measure); }
.article-body > .block-width-wide { max-width: var(--wide); }
.article-body > .block-width-full {
  max-width: none;
  margin-left: calc(-1 * var(--gutter));
  margin-right: calc(-1 * var(--gutter));
  padding: 0 var(--gutter);
}
.table-scroll { overflow-x: auto; }
.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.5;
}
.article-body th,
.article-body td {
  padding: 0.65em 0.8em;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
.article-body th {
  background: var(--alternate);
  color: var(--on-alternate);
  border-bottom: 0;
}

/* Figures: no frames; the photograph is the point. Captions sit below in
   small, quiet type. */
.article-body > .block-figure {
  max-width: var(--measure);
  margin: 2.5rem auto;
  clear: both;
}
.article-body > .figure-wide { max-width: var(--wide); }
.article-body > .figure-full {
  width: 100vw;
  max-width: none;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}
.block-figure .lightbox { display: block; cursor: zoom-in; }
.block-figure img { display: block; width: 100%; height: auto; }
.block-figure figcaption {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
}
.figure-full figcaption { padding: 0 var(--gutter); }
@media (min-width: 44rem) {
  .article-body > .figure-left,
  .article-body > .figure-right {
    clear: none;
    width: min(20rem, 45%);
    margin-top: 0.4rem;
    margin-bottom: 1rem;
  }
  .article-body > .figure-left {
    float: left;
    margin-left: max(0px, calc((100% - var(--measure)) / 2));
    margin-right: 1.75rem;
  }
  .article-body > .figure-right {
    float: right;
    margin-right: max(0px, calc((100% - var(--measure)) / 2));
    margin-left: 1.75rem;
  }
}
.rangefinder .block-layout figcaption,
.rangefinder .block-gallery figcaption { color: var(--muted); }

/* Code: set in the alternate color, like a second material. */
.article-body > .block-code { margin: 0 auto 1.8em; }
.block-code .code-box { position: relative; }
.block-code pre {
  margin: 0;
  padding: 1.1rem 1.35rem;
  overflow-x: auto;
  background: var(--alternate);
  color: var(--on-alternate);
  border-radius: 2px;
  font: 0.875rem/1.6 var(--mono);
  tab-size: 4;
}
.block-code pre code { padding: 0; background: none; color: inherit; font: inherit; }
.block-code .code-box:has(.code-copy) pre { padding-right: 3.25rem; }
.chroma [class^="k"],
.chroma .o,
.chroma .ow { color: color-mix(in srgb, var(--highlight) 55%, white); }
.chroma [class^="s"] { color: #d8d2bf; }
.chroma [class^="m"],
.chroma .no { color: #b8c7cf; }
.chroma [class^="c"] { color: #8e969b; font-style: italic; }
.chroma .nf,
.chroma .nc { color: #ffffff; font-weight: 500; }
.chroma .gd { color: #ffb3ad; }
.chroma .gi { color: #b9e3c0; }
.chroma .line { display: flex; }
.block-code .code-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--on-alternate) 25%, transparent);
  border-radius: 2px;
  background: var(--alternate);
  color: var(--on-alternate);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.block-code .code-copy[hidden] { display: none; }
.is-preview .block-code .code-copy[hidden] { display: grid; opacity: 1; }
.block-code:hover .code-copy,
.block-code .code-copy:focus-visible { opacity: 1; }
@media (hover: none) { .block-code .code-copy { opacity: 1; } }
.block-code .code-copy .icon-done { display: none; }
.block-code .code-copy.copied { color: var(--highlight); opacity: 1; }
.block-code .code-copy.copied .icon-copy { display: none; }
.block-code .code-copy.copied .icon-done { display: block; }

.rf-article-footer {
  max-width: var(--measure);
  margin: 3.5rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  --share-fg: var(--ink);
  --share-bg: var(--paper);
  --share-rule: var(--rule);
  --share-accent: var(--highlight);
}
.rf-article-footer:empty { display: none; }

/* The post's tags, above the share menu. */
.rf-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  font-family: var(--sans);
  font-size: 0.85rem;
}
.rf-tags a {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
}
.rf-tags a:hover { border-color: currentColor; }
@media print {
  .rf-article-footer { display: none; }
}

/* Footer: a band in the alternate color. */
.rf-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.25rem var(--edge);
  background: var(--alternate);
  color: var(--on-alternate);
}
.rf-footer-brand { display: inline-flex; align-items: center; gap: 0.6rem; }
.rf-footer-brand:hover { color: inherit; }

@media (max-width: 40rem) {
  .rf-header { grid-template-columns: minmax(0, 1fr); }
}
