.article {
  max-width: 780px;
  margin: 0 auto;
  padding: 2.2rem 1.5rem 4rem;
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--soft);
}

/* Blocks are inert containers: no margins, no size, no tracking, no colour of
   their own. A return advances one line, exactly like a text editor, and
   vertical air exists only where the author typed a blank line — an empty
   block, which renders at line height. Everything visible is something typed.
   (h1-h3 can no longer be produced; the selector keeps any stray legacy page
   degrading to body text instead of resurrecting heading chrome.) */
.article :is(h1, h2, h3, p) {
  margin: 0;
  font-size: inherit;
  font-weight: 400;
  letter-spacing: inherit;
}

/* Bold is weight and nothing else.
   It used to brighten to --strong as well, which made B a colour control by
   accident: bolding plain text turned it white, debolding turned it grey, and
   the same words bolded two different ways (a ** in the markdown, or a chart
   row's own weight class) did not match. A tool changes the one thing it is
   named after. Colour comes from the swatches, size from the sizes. */

.article figure {
  margin: 1.8rem 0;
}

.article figure img {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  cursor: zoom-in;
}

.article figure video {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: #000;
}

/* Same ink as the body text and as the lightbox field the caption is written
   in — only smaller. It used to be --muted, which meant text that read white
   while he typed it landed grey on the page. What you author is what you get. */
.article figcaption {
  margin-top: 0.55rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--soft);
}

/* ---------- chart filter ---------- */
/*
   The grid's sorting, dressed for the chart: routes read as the two big
   choices, locations appear only once a route is chosen, and the pills wear
   the same capsule the entries do — outline at rest, the site's selection
   blue when on. Buttons injected by article.js; never part of the markdown.
*/
.chart-filter {
  margin-bottom: 1.1rem;
}

.chart-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.chart-row + .chart-row {
  margin-top: 0.45rem;
}

.chart-locs.hidden {
  display: none;
}

.chart-pill {
  display: inline-flex;
  align-items: center;
  height: 1.5rem;
  padding: 3.35px 0.7rem 0;
  border: none;
  border-radius: 999px;
  background: none;
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease;
}

.chart-pill:hover {
  box-shadow: none;
  background: rgb(0, 40, 255);
  color: #fff;
}

.chart-pill.on,
.chart-pill.on:hover {
  box-shadow: none;
  background: rgb(0, 40, 255);
  color: #fff;
}

/* The locations are the smaller word — dependent on the route above them. */
.chart-locs .chart-pill {
  height: 1.3rem;
  font-size: 0.66rem;
}

.article .entry.culled {
  display: none;
}

/* SHARE, riding the right end of the subnav on every article page. */
.subnav .article-share {
  margin-left: auto;
}

/* An open entry's own share, at the right end of its row. Hidden while the
   row is closed — a collapsed chart line is for scanning, not pointing. */
.article .entry-head {
  position: relative;
}

.article .entry[open] > .entry-head {
  padding-right: 5.2rem;
}

/* The same pill as every other SHARE — .chart-pill carries the look and the
   size; this only parks it at the row's right edge and gates it on open. */
.entry-share {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  display: none;
}

.article .entry[open] > .entry-head .entry-share {
  display: inline-flex;
}

@media print {
  .chart-filter,
  .article-share,
  .entry-share {
    display: none;
  }
}

/* ---------- chart entries ---------- */
/*
   A chart article reads as a list of capsules: one line each, click to open,
   any number open at once. <details> does the behaviour; everything here is
   the surface it wears. Same recipe as an article card on the index — a plate
   a shade off the page, a hairline round it, soft corners — because they are
   the same idea, a closed thing you open.
*/
.article .entry {
  margin: 0.6rem 0;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--card);
  transition: border-color 200ms ease, background-color 200ms ease;
}

.article .entry:hover {
  border-color: var(--muted);
}

/* An open entry lifts a little further off the page — the one being read is
   the one that should look nearest. */
.article .entry[open] {
  border-color: var(--muted);
  background: var(--tile);
}

/* The row itself. No font-size, weight or colour here on purpose: the summary
   is the author's own subtitle line and carries its own spans, so anything
   set here would quietly overrule what they wrote. */
.article .entry-head {
  /* Deliberately not a flex container: the summary's children are the author's
     own inline spans, and flex would make each of them an item with its own
     box — the "|" separators included — which is not a sentence any more. It
     stays a block of inline text, and the chevron gets a gutter of padding
     rather than a place in a row. */
  padding: 0.7rem 0.95rem;
  border-radius: 0.6rem;
  cursor: pointer;
  /* The row is one line where there is room, and wraps rather than truncating
     where there isn't: a name cut off mid-word tells a reader nothing, and on
     a phone the last segment is usually the one they came for. */
  line-height: 1.45;
  /* Safari and Chrome both put a disclosure triangle here. There is no marker
     at all now: the capsule itself is the control, and a row that is one line
     of type reads better without a glyph competing with the date. */
  list-style: none;
}

.article .entry-head::-webkit-details-marker {
  display: none;
}

/* Nothing to see while the row is closed and the pointer is elsewhere — the
   chevron is enough of a handle. */
.article .entry-head:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

/* The body sits under the row, in the same column the row's text starts in, so
   the entry reads as one object rather than a lid on a box. */
.article .entry > :not(.entry-head) {
  margin-left: 0.95rem;
  margin-right: 0.95rem;
}

/* A breath between the row and what it opens onto, so the first line does not
   look glued to the lid. */
.article .entry-head + * {
  margin-top: 0.3rem;
}

.article .entry > :not(.entry-head):last-child {
  margin-bottom: 0.9rem;
}

/* A photo inside an entry keeps the inset but loses the article's own big
   vertical margins — inside a capsule that much air reads as a gap. */
.article .entry figure {
  margin: 1rem 0;
}

/* ---------- inline size and colour ---------- */

/* Size is a property of the text, not of the block it sits in — and size is
   ONLY size. No tracking, no colour rides along: colour comes from the
   swatches, weight from B, and big text defaults to nothing but big. The
   line-height keeps a sized line from colliding with its neighbours. */
.s-title,
.article .entry[open] > .entry-head .os-title,
.article .entry:not([open]) > .entry-head .cs-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.15;
}

.s-subtitle,
.article .entry[open] > .entry-head .os-subtitle,
.article .entry:not([open]) > .entry-head .cs-subtitle {
  font-size: 1.35rem;
  line-height: 1.3;
}

.s-large,
.article .entry[open] > .entry-head .os-large,
.article .entry:not([open]) > .entry-head .cs-large {
  font-size: 1.08rem;
  line-height: 1.4;
}

/* The body colour, sayable by name — the Default swatch writes it where mere
   absence would inherit something else, which today means inside a link. */
.c-default { color: var(--soft); }

.c-muted, .article .entry[open] > .entry-head .oc-muted,
.article .entry:not([open]) > .entry-head .cc-muted { color: var(--muted); }
.c-amber, .article .entry[open] > .entry-head .oc-amber,
.article .entry:not([open]) > .entry-head .cc-amber { color: var(--c-amber); }
.c-blue,  .article .entry[open] > .entry-head .oc-blue,
.article .entry:not([open]) > .entry-head .cc-blue  { color: var(--c-blue); }

/* ---------- the open state's own look ----------
   The same run of text, dressed differently once the entry is open: a
   companion class per family, read only while the capsule is open, so one span
   carries both states and nothing has to be written twice. Absent means "no
   change" — the closed look carries straight over.
   The three above share their declaration with their twin rather than repeat
   the value, which is the only way os-large stays exactly s-large. These four
   have no twin to share with: "default" and "body" are the ABSENCE of a class
   in the closed state, and absence cannot be asked for by name. */
.article .entry[open] > .entry-head .oc-default,
.article .entry:not([open]) > .entry-head .cc-default { color: var(--soft); }
.article .entry[open] > .entry-head .os-body,
.article .entry:not([open]) > .entry-head .cs-body {
  /* .article's own size and leading — body text, named so it can be chosen. */
  font-size: 1.02rem;
  line-height: 1.65;
}
.article .entry[open] > .entry-head .ow-bold,
.article .entry:not([open]) > .entry-head .cw-bold { font-weight: 700; }
.article .entry[open] > .entry-head .ow-normal,
.article .entry:not([open]) > .entry-head .cw-normal { font-weight: 400; }

/* Slant, held per state exactly as weight is — so I changes one state's
   italics and leaves the other alone, the same as B. */
.article .entry[open] > .entry-head .oi-italic,
.article .entry:not([open]) > .entry-head .ci-italic { font-style: italic; }
.article .entry[open] > .entry-head .oi-normal,
.article .entry:not([open]) > .entry-head .ci-normal { font-style: normal; }



/* ---------- author-only editing ---------- */

:root.editing .article {
  outline: none;
}

/* A blank article is genuinely empty, so its one block would collapse to
   nothing and leave no caret target. One role-free hint — there are no title
   or subtitle slots, just text. Author-only: readers never see an empty
   block. */
:root.editing .article > :first-child:empty::before {
  content: "Start writing — the top of the article is what the card shows.";
  color: var(--faint);
  /* Placeholders are scenery: never selectable, never serialised. */
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

:root.editing .article figure.selected img,
:root.editing .article figure.selected video,
:root.editing .article figure.selected .video-pending {
  outline: 2px solid #e8b64c;
  outline-offset: 3px;
}

:root.editing .article figure {
  cursor: grab;
}

:root.editing .article figure.dragging {
  opacity: 0.35;
}

/* The gap a drop will fill — for photos coming in from Finder and for a figure
   being moved alike. Amber is the editing colour, same as the selection ring. */
.drop-line {
  height: 2px;
  margin: 0.7rem 0;
  border-radius: 2px;
  background: #e8b64c;
  box-shadow: 0 0 10px rgba(232, 182, 76, 0.55);
}

/* An uploaded video before the build has made its delivery encode. */
.video-pending {
  display: grid;
  place-items: center;
  min-height: 8rem;
  border: 1px dashed var(--border);
  border-radius: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

/* Sits inside .subnav, after LIGHT MODE. Wraps rather than pushing the row
   wider than the window, and follows the theme like the rest of the bar. */
.edit-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
}

.edit-bar button {
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.38rem;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
}

.edit-bar button:hover:not(:disabled) {
  border-color: var(--muted);
}

.edit-bar .swatch {
  min-width: 1.1rem;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border-radius: 999px;
}

.edit-bar .edit-sep {
  width: 1px;
  height: 1.1rem;
  background: var(--border);
  margin: 0 0.15rem;
}

.edit-bar .edit-save {
  border-color: #c0392b;
  background: #c0392b;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.edit-bar .edit-save:hover:not(:disabled) {
  border-color: #e04b3a;
  background: #e04b3a;
}

/* Nothing to save — greyed out and inert. */
.edit-bar .edit-save:disabled {
  border-color: var(--border);
  background: var(--panel);
  color: var(--faint);
  cursor: default;
}

.edit-bar .edit-status {
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  min-width: 3.5rem;
}

/* HIDDEN is a state, so it reads lit when it is on — the same convention the
   grid's curate bar uses for PIN and the stars. */
.edit-bar .edit-toggle.lit {
  border-color: var(--c-amber);
  color: var(--c-amber);
  font-weight: 700;
}

/* Red is consequential here, as it is for DELETE and PUSH on the grid. It acts
   on the first click, so it looks like the deed rather than an invitation. */
.edit-bar .edit-delete {
  border-color: #c0392b;
  background: #c0392b;
  color: #ffffff;
  font-weight: 700;
}

.edit-bar .edit-delete:hover:not(:disabled) {
  border-color: #e04b3a;
  background: #e04b3a;
}

/* A hidden article says so while you are reading it, so there is no way to
   forget why it never turned up on the site. */
:root.article-hidden .article::before {
  content: "HIDDEN — not published";
  display: block;
  margin-bottom: 1.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--c-amber);
  color: var(--c-amber);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

/* A phone gets one line per collapsed row, whatever it takes: the row is
   forbidden to wrap, and article.js measures each one and sets --fit so its
   own text just fits — short rows keep full size, the longest shrink alone.
   Only the collapsed look scales; an open entry reads at full size. Lives at
   the end of the sheet: it must outrank the cs-body size it overrides. */
/* An `embed:` page (build_articles.py): its own hand-built charts, framed so
   their stylesheet can't fight this one. Wider than the reading column — the
   charts were drawn for ~940px — and sized to its content by article.js. */
/* The masthead above an embed takes the embed's width, so the title and the
   charts share one left edge instead of two centred columns of different
   widths. Same side padding on both (border-box), so the edges match. */
.article:has(+ .article-embed) {
  max-width: 940px;
}

.article-embed {
  max-width: 940px;
  margin: -2rem auto 4rem;
  padding: 0 1.5rem;
}

.article-embed-frame {
  display: block;
  width: 100%;
  height: 1600px;
  border: 0;
  background: transparent;
  color-scheme: normal;
}

@media (max-width: 620px) {
  .article .entry:not([open]) > .entry-head {
    white-space: nowrap;
    overflow: hidden;
    /* The floor on --fit keeps type legible; a row that would need less
       trails off instead of hard-clipping mid-letter. */
    text-overflow: ellipsis;
  }
  /* Every span, not just the canon class: a row segment that lost its size
     class in editing would otherwise sit at full size while the fit loop
     shrinks its neighbours to the floor chasing a fit it can never reach. */
  .article .entry:not([open]) > .entry-head span {
    /* !important, deliberately: this must beat every size class an author
       span can carry (cs-body outranks this selector on class count), and it
       exists only inside this media query, only for collapsed rows, only for
       size. */
    font-size: calc(1.02rem * var(--fit, 1)) !important;
  }
}
