@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Serif:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=JetBrains+Mono:wght@400;500&display=swap');
@import url('tokens.css?v=6');

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

:root {
  --rail: 4rem;      /* date / label column width, shared by .item and .now-row */
  --rail-gap: 2.5rem;
  --day-pad: 2.25rem;  /* space above and below each day's block */
  --post-gap: 3rem;    /* space between posts that share a day */
  --split-width: 22rem; /* widest a right-aligned history line gets; smaller = year sits closer to the title */
}

/* Smooth scrolling only for visitors who haven't asked for reduced motion */
@media (prefers-reduced-motion: no-preference) {
  html { 
    scroll-behavior: smooth; 
  }
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── Custom Bespoke Typography & Links ── */
a { 
  color: var(--ink); 
  text-decoration: none;
  position: relative;
  font-weight: 500;
  transition: color var(--dur-base) ease;
}

a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: var(--accent);
  transform: scaleX(0);
  transform-origin: bottom center;
  transition: transform var(--dur-expand) ease-out;
}

a:hover {
  color: var(--accent);
}

a:hover::after {
  transform: scaleX(1);
  transform-origin: bottom center;
}

/* Specific resets for the H1 site title link */
.brand-link {
  color: inherit;
  font-weight: inherit;
}

.brand-link::after {
  display: none !important; /* Removes animated underline on the title */
}

.brand-link:hover {
  color: var(--accent);
}

/* ── Links inside posts, lists and the Now block ── */
/* Post links: accent colour plus a thin always-on underline, so a link never
   relies on colour alone (about 9.9:1 on light, 6.4:1 on dark). The underline
   thickens on hover. The site-wide animated underline is switched off here so
   the two don't double up. Link cards have their own styling. */
.item-body a:not(.link-card) {
  color: var(--accent);
  font-weight: 400;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transition: color var(--dur-base) ease, text-decoration-color var(--dur-base) ease;
}

.item-body a:not(.link-card):hover {
  text-decoration-thickness: 2px;
  text-decoration-color: var(--accent);
}

.item-body a:not(.link-card)::after {
  display: none;
}

/* Now block and history: titles keep the main text colour with a faint dotted
   underline, so a column of titles reads as a list instead of a column of blue
   links. Hover turns them accent with a solid underline. */
.now a {
  font-weight: 400;
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--ink-faint);
}

.now a:hover {
  color: var(--accent);
  text-decoration-style: solid;
  text-decoration-color: var(--accent);
}

.now a::after {
  display: none;
}

blockquote {
  margin: 1.5rem 0;
  padding-left: 1.5rem;
  border-left: 2px solid var(--accent);
  font-style: italic;
  color: var(--ink-mid);
}

::selection {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  color: inherit;
}

/* Keyboard focus: one accent ring for links and buttons. Components with their
   own focus style (link card, back-to-top, theme switch) keep it. */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ── Main Layout Frame ── */
/* Centered: max-width + auto side margins, border-box so the 1.5rem
   side padding is included in the 660px. */
.page {
  max-width: 660px;
  margin: 0 auto;
  padding: 5rem 1.5rem;
}

/* ── Header ── */
header {
  margin-bottom: 2rem;
  border-bottom: 1px dashed var(--rule);
  padding-bottom: 2rem;
}

header h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-align: left;
}

header p {
  font-size: var(--fs-small);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 0.6rem;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.35rem; /* Tighter gap for typographic icon pairing */
}

.bullet-spacer {
  user-select: none;
  color: var(--ink-faint);
}

/* Precise sizing engine for the inline SVG pin */
.geo-pin {
  width: 0.85rem;
  height: 0.85rem;
  color: var(--ink-faint);
  flex-shrink: 0;
  position: relative;
  top: -1px; /* Subtle optical alignment adjustment */
}

/* ── Feed Stream ── */
.feed {
  display: flex;
  flex-direction: column;
}

/* ── Day Blocks ── */
/* Spacing model, one rule per relationship (feed.php wraps each date in a .day):
   - space between days  -> .day padding (--day-pad)
   - space between posts on the same day -> .day gap (--post-gap)
   Each post's dateline marks where it starts, so there is no solid line
   between days. Nothing depends on a post's neighbours. */
.day {
  display: flex;
  flex-direction: column;
  gap: var(--post-gap);
  padding: var(--day-pad) 0;
}

/* The "Blog" label sits above the feed, in the rail, whether or not there are posts */
.feed-label {
  padding-bottom: 0.4rem;
}

/* The newest day sits right under the label (or, on the 404 / 403 pages, right
   under the header), so it gets a tighter top */
.feed-label + .day,
.day:first-child {
  padding-top: 0.75rem;
}

/* The last day gets extra room above the footer line */
.feed .day:last-child {
  padding-bottom: 3rem;
}

/* ── Two-Column Grid Item ── */
.item {
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  gap: 0 var(--rail-gap);
  align-items: start;
}

/* ── Empty State (no posts yet) ── */
/* Left-aligned in the content column, like every other row on the page. */
.item-empty,
.item-error {
  display: block; /* label sits above, as with posts; the text is flush left */
}

.item-body .empty-note {
  color: var(--ink-mid);
}

/* The empty state and the 404 / 403 pages share one look: the same title, the same note and the same
   dashed icon box in the rail (desktop; hidden on phones). */

/* The "Blog" label is a heading in the post-title style: serif, semibold, 1.25rem, in the same ink as the site title */
.empty-label {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.024em;
  color: var(--ink);
  white-space: nowrap;
  text-transform: none; 
}

/* ── Left-Aligned Rails ── */
/* Posts that open with a title: align the date to the title's BASELINE
   instead of nudging by hand. This stays correct at any title size.
   Scoped with :has() on purpose: a post that starts with an image has its
   baseline at the image's bottom edge, which would drag the date down. */
.item:has(.item-body > :is(h1, h2, h3, h4, .item-title):first-child) {
  align-items: first baseline;
}

/* A link to a post (from the RSS feed) lands with the pinned day header clear of it */
.item[id] {
  scroll-margin-top: 4.5rem;
}

/* ── Dateline (the top of every post) ── */
/* Weekday and date on the left, a dashed rule, the
   time on the right. Same on desktop and phone. A post gets the full width. */
.item-post {
  display: block;
}

.dateline {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

.dl-date {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-mid);
  white-space: nowrap;
}

/* Later posts on the same day skip the visible date (the post above already
   gave it). It stays in the page for screen readers. */
.dl-repeat {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.dl-rule {
  flex: 1;
  min-width: 1rem;
  border-bottom: 1px dashed var(--rule);
  position: relative;
  top: -0.28rem;
}

.dl-time {
  font-family: var(--font-mono);
  font-size: 0.81rem;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* A date sits on a dashed line. A day with one post puts its date on that post's
   line; a day with several puts the date and the post count on a header line,
   and the posts under it have no line of their own. */
.item-post:not(.same-day-post) .dateline {
  margin-bottom: 1.2rem;
}

/* Posts inside a multi-post day: the time on the left and n/N on the right.
   The rule is kept (invisible) so n/N stays at the right edge. The day header above carries the date. */
.same-day-post .dateline {
  align-items: center;
  gap: 0.7rem;
}

.same-day-post .dl-time { order: 1; }

.same-day-post .dl-rule {
  order: 2;
  border-bottom-color: transparent;
  top: 0;
}

/* "2 of 6": where this post sits in its day, at the right end of the line */
.dl-count {
  order: 3;
  font-family: var(--font-mono);
  font-size: 0.81rem;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Day header (only days with more than one post): the date and post count stay
   pinned at the top while you scroll through that day, then the next day's
   header takes over. It is a sticky child of .day, so it releases at the end of
   the day. The faint fade below it softens the edge where posts slide under. */
.day-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  /* Extra room above the text when pinned; the negative margin takes it back
     so the resting layout does not move */
  padding: 1.3rem 0 0.5rem;
  margin-top: -0.8rem;
  margin-bottom: calc(var(--post-gap) * -1 + 1.2rem);
  background: var(--bg);
}

.day-head::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 0.9rem;
  background: linear-gradient(var(--bg), transparent);
  pointer-events: none;
}

.dh-date {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-mid);
  white-space: nowrap;
}

.dh-rule {
  flex: 1;
  min-width: 1rem;
  border-bottom: 1px dashed var(--rule);
  position: relative;
  top: 0.02rem;
}


.dh-count,
.dh-time,
.dh-n {
  font-family: var(--font-mono);
  font-size: 0.81rem;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  white-space: nowrap;
}

/* With JavaScript the pinned header follows you through the day: once a post's
   own line has scrolled under it, the "N posts" total gives way to that post's
   time and number. Without JavaScript the total simply stays. */
.dh-live { display: none; }
.day-head.is-live .dh-live { display: inline-flex; align-items: baseline; gap: 0.5rem; }
.day-head.is-live .dh-count { display: none; }
.dh-time { white-space: nowrap; }
a.dh-time { text-decoration: none; transition: color var(--dur-base) ease; }
a.dh-time::after { display: none; }
a.dh-time:hover,
a.dh-time:focus-visible { color: var(--accent); }
/* The day's post count is a link to the newest post of that day (its page lists the rest).
   Quiet at rest, accent on hover and keyboard focus. justify-self keeps the link as wide as
   its text in the desktop grid instead of stretching across the column. */
a.dh-date { justify-self: start; text-decoration: none; transition: color var(--dur-base) ease; }
a.dh-date::after { display: none; }
a.dh-date:hover,
a.dh-date:focus-visible { color: var(--accent); }
.dh-n { font-variant-numeric: tabular-nums; }

/* A middle dot between the post's time and its number (skipped when a post has no time) */
.dh-n::before { content: "·"; margin-right: 0.5rem; }
.dh-time:empty + .dh-n::before { display: none; }

/* ── Content Blocks ── */
.item-body { 
  min-width: 0; 
  text-align: left;
  overflow-wrap: break-word; /* long URLs / unbroken strings wrap instead of widening the page */
}

.item-body p { 
  font-size: 1rem; 
  color: var(--ink); 
  margin-bottom: 0.85rem; 
  text-align: left; 
}

/* A horizontal line in a post: a faint hairline that follows the text colour, with room on both sides */
.item-body hr {
  height: 0;
  margin: 2.25rem 0;
  border: 0;
  border-top: 1px solid color-mix(in srgb, var(--ink) 15%, transparent);
}

.item-body p:last-child { 
  margin-bottom: 0; 
}

/* Whatever a post ends with (quote, list, image, code...) must not add its own bottom margin,
   so the space to the next post is the same for every post type */
.item-body > :last-child,
.bullets > :last-child,
.item-body > p:last-child > img:last-child { margin-bottom: 0; }

/* ── Post Titles ── */
/* Markdown headings (# Title) and .item-title share one style. Without this,
   h1–h4 fall back to browser-default sizes (h1 ≈ 2em), which is what made
   "Sidewalks" nearly as large as the site name. */
.item-title,
.item-body h1,
.item-body h2,
.item-body h3,
.item-body h4 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.35;
  margin-bottom: 0.6rem !important;
  text-wrap: balance;   /* no single word left alone on the last line of a title */
}
/* Post titles are noticeably larger than the text under them */
.item-body h1 {
  font-size: 1.25rem;
  line-height: 1.26;
  letter-spacing: -0.024em;
  margin-bottom: 0.7rem !important;
}
.item-body h2 {
  font-size: 1.12rem;
  line-height: 1.3;
}

/* A heading in the middle of a post gets breathing room above it */
.item-body :is(h1, h2, h3, h4):not(:first-child) {
  margin-top: 1.5rem;
}

/* Inline Code Elements */
.item-body code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--wash);
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
  color: var(--ink-mid);
}

/* Code blocks: a bordered box like the picture rows and buttons. A long line scrolls
   sideways inside the box instead of widening the page. */
.item-body pre {
  margin: 1.5rem 0;
  padding: 1rem 0 1rem 1.15rem;   /* no padding on the right here: the code carries it, so every browser scrolls to the same space as on the left */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}
.item-body pre code {
  display: block;
  /* as wide as its longest line plus the same space as on the left, so a scrolled line ends with room before the border */
  box-sizing: border-box;
  width: max-content;
  min-width: 100%;
  background: none;
  padding: 0 1.15rem 0 0;
  border-radius: 0;
  font-size: 0.85rem;
  line-height: 1.65;
  white-space: pre;
}

/* ── Content Lists (Unordered & Ordered Native Alignment Engine) ── */
.bullets-label {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--ink-faint);
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  display: block;
}

/* Unified Layout Container for any stream lists */
.bullets ul, .item-body ul,
.bullets ol, .item-body ol {
  margin: 1rem 0;
  padding-left: 1.25rem; /* Native, rock-solid vertical alignment rail */
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Lists: same ink and size as paragraphs so they read as part of the post */
.bullets ul, .item-body ul {
  list-style-type: disc;
}
.bullets ol, .item-body ol {
  list-style-type: decimal;
}
.bullets li, .item-body li {
  font-size: 1rem;
  color: var(--ink);
  line-height: 1.6;
  padding-left: 0.25rem; /* Breathing room between the marker and the text */
}

/* ── Tables (Markdown) ── */
/* feed.php wraps each table in .table-wrap. The table sizes itself to its
   content (so columns never get squeezed into one-word lines) and the wrapper
   scrolls sideways when it's wider than the post. Short tables still stretch
   to the full width. Long text in a cell wraps at 20rem. */
.table-wrap {
  margin: 1.25rem 0;
  overflow-x: auto;
  overflow-wrap: normal;
  /* Soft edge shadows that only appear on a side that has more to scroll to */
  background:
    linear-gradient(to right, var(--bg) 30%, transparent) left center / 2rem 100% no-repeat local,
    linear-gradient(to left,  var(--bg) 30%, transparent) right center / 2rem 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%,   var(--border-quiet), transparent) left center  / 0.6rem 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--border-quiet), transparent) right center / 0.6rem 100% no-repeat scroll;
}

.table-wrap:first-child { margin-top: 0; }
.table-wrap:last-child  { margin-bottom: 0; }

.item-body table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  line-height: 1.5;
}

.item-body th,
.item-body td {
  min-width: 4.5rem;
  max-width: 20rem;
  padding: 0.55rem 1.5rem 0.55rem 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px dashed var(--border-quiet);
}

.item-body th:last-child,
.item-body td:last-child {
  padding-right: 0.5rem;
}

/* Header cells match the mono labels used elsewhere */
.item-body th {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
  border-bottom: 1px solid var(--border-quiet);
}

.item-body tbody tr:last-child td {
  border-bottom: none;
}

/* ── Fluid Markdown Images ── */
/* Flush with the text column, with the same 6px corners as the picture rows and the back buttons */
.item-body img {
  display: block;
  max-width: 100%;
  margin: 2rem 0;
  height: auto;
  border-radius: var(--radius-md);
}

/* Clean Inline Link Blocks */
.link-card {
  position: relative;
  padding-right: 2.4rem; /* room for the corner arrow */
  transition: background-color var(--dur-base) ease, border-color var(--dur-base) ease;
  display: flex;
  flex-direction: column;
  background: transparent;
  border: 1px solid var(--border-quiet);
  padding: 0.85rem 1.1rem;
  margin-top: 1rem;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-md);
}

/* The accent bar is a 2px strip inside the border, so all four borders are the
   same 1px and the corners stay square-cut instead of angled. This replaces the
   site-wide animated underline, which doesn't belong on a card. */
.link-card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  height: auto;
  background: var(--accent);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  transform: none;
}

/* Corner arrow: a quiet "this is clickable" cue that lights up on hover. A drawn icon (the same 1.6 line weight and
   round ends as the site's other icons), coloured by the background so it follows the text colours */
.link-card::before {
  content: "";
  position: absolute;
  top: 0.8rem;
  right: 0.95rem;
  width: 0.85rem;
  height: 0.85rem;
  background-color: var(--ink-faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 17.5L17.5 6.5M8.5 6.5h9v9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 17.5L17.5 6.5M8.5 6.5h9v9'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: background-color var(--dur-base) ease, transform var(--dur-expand) ease;
}

/* Hover / keyboard focus: the whole border turns accent, with a faint tint */
.link-card:hover,
.link-card:focus-visible {
  border-color: var(--accent);
  background-color: color-mix(in srgb, var(--accent) 7%, transparent);
}

.link-card:hover::before,
.link-card:focus-visible::before {
  background-color: var(--accent);
  transform: translate(4px, -4px);
}

.link-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.lc-domain {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.2rem;
  letter-spacing: 0.04em;
}

.lc-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.4;
}

.lc-desc {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--ink-mid);
  margin-top: 0.25rem;
  line-height: 1.4;
}

/* Embed Blocks */
.embed-wrap { 
  margin-top: 1rem; 
  border-radius: var(--radius-md); 
  overflow: hidden; 
}

.embed-wrap iframe { 
  display: block; 
  width: 100%; 
  border: none; 
}

.embed-wrap.video iframe { 
  aspect-ratio: 16/9; 
}

.embed-wrap.music iframe { 
  height: 152px; 
}

.embed-caption { 
  display: block; 
  font-family: var(--font-mono); 
  font-size: var(--fs-small); 
  color: var(--ink-faint); 
  margin-top: 0.4rem; 
}

/* Inline Metadata Tags */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--ink-faint);
  margin-right: 0.7rem;
  margin-top: 0.6rem;
}
.tag::before {
  content: "#";
}

/* ── Footer ── */
footer {
  position: relative;
  border-top: 1px dashed var(--rule);
  padding-top: 2rem;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--ink-faint);
}

footer p { 
  margin-bottom: 0.4rem; 
}

/* Footer links: lighter weight and softer ink so they sit with the
   mono labels instead of shouting. Hover still turns accent + underline. */
footer a {
  font-weight: 400;
  color: var(--ink-mid);
}

/* Back to top: a small square that sits on the dashed footer line, like a tab,
   and is only shown when there are posts and the page is long enough to scroll */
.to-top {
  position: absolute;
  right: 0;
  top: -0.83rem;
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border: 1px solid var(--border-quiet);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--ink-faint);
  transition: color var(--dur-base) ease, border-color var(--dur-base) ease, background-color var(--dur-base) ease;
}

.to-top::after {
  display: none;
}

/* Hover / keyboard focus matches a link card: accent border, faint accent tint,
   accent arrow. The tint is mixed with --bg so the button stays opaque and the
   dashed footer line doesn't show through it. */
.to-top:hover,
.to-top:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  background-color: color-mix(in srgb, var(--accent) 7%, var(--bg));
}

.to-top[hidden] {
  display: none;
}

.to-top svg {
  width: 0.667rem;
  height: 0.667rem;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--icon-stroke, 1.5);
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Desktop: dates in the left column ── */
/* From 581px up, each post is two columns: date and time in the rail on the left,
   the post on the right (the same columns as the Now block). On a phone the posts
   stay stacked under a full-width dateline, with the pinned day line. */
.item-empty .dateline,
.item-error .dateline { display: none; }               /* no placeholder box on phones */

/* Post titles sit a touch softer than the body text */
.item-post .item-body :is(h1, h2, h3, h4) {
  color: var(--ink-soft);
}

/* A little more room between the "Blog" label and the newest post */
.feed-label + .day {
  padding-top: 1.5rem;
}

@media (min-width: 581px) {
  /* A day with several posts: a header row with the date in the left column and the
     post count beside it. The posts below show just their time. Not pinned on desktop. */
  .day-head {
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 1fr);
    column-gap: var(--rail-gap);
    align-items: baseline;
    position: static;
    padding: 0;
    margin: 0 0 calc(var(--post-gap) * -1 + 1.4rem);
    background: none;
  }
  .day-head::after,
  .dh-rule,
  .dh-live,
  .dh-wd { display: none; }
  .dh-date { font-size: 0.85rem; line-height: 1.4; }
  .dh-count { font-size: var(--fs-label); line-height: 1.4; }

  .item.item-post,
  .item-error,
  .item-empty {
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 1fr);
    column-gap: var(--rail-gap);
    align-items: first baseline;   /* date or code shares a baseline with the title or first line */
  }

  .item.item-post .dateline {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.7rem;
    margin: 0;
  }

  .dl-rule,
  .dl-count { display: none; }

  .dl-date {
    display: block;
    font-weight: 500;
    color: var(--ink-mid);
    white-space: nowrap;
  }

  .dl-wd { display: none; }                            /* the weekday stays on phones */
  .dl-time { font-size: var(--fs-label); }

  /* Several posts in one day: the date lives in the day header, so each post shows only its time */
  .same-day-post .dl-repeat { position: absolute; }
  .same-day-post .dl-time { order: 2; }

  /* A post that opens with a video, image or card lines the date up with the top of it */
  .item.item-post:has(:is(.item-body > :first-child:is(.embed-wrap, figure, img, .link-card), .item-body > p:first-child > img:first-child)) {
    align-items: start;
  }
  .item.item-post :is(.item-body > :first-child:is(.embed-wrap, figure, img, .link-card), .item-body > p:first-child > img:first-child) {
    margin-top: 0;
  }
  .item.item-post .item-body > p:first-child:has(> img:first-child) {
    margin-top: 0;
  }
  @supports (text-box: trim-start cap alphabetic) {
    .item.item-post:has(:is(.item-body > :first-child:is(.embed-wrap, figure, img, .link-card), .item-body > p:first-child > img:first-child)) :is(.dl-date, .dl-time) {
      text-box: trim-start cap alphabetic;
    }
    /* The date and time are trimmed to their capitals here, so the gap is larger to keep the same 33px between them */
    .item.item-post:has(:is(.item-body > :first-child:is(.embed-wrap, figure, img, .link-card), .item-body > p:first-child > img:first-child)) .dateline {
      gap: 1.07rem;
    }
  }
  @supports not (text-box: trim-start cap alphabetic) {
    .item.item-post:has(:is(.item-body > :first-child:is(.embed-wrap, figure, img, .link-card), .item-body > p:first-child > img:first-child)) .dateline {
      padding-top: 0.2rem;
    }
  }

  /* Empty state: a dashed placeholder box in the rail, centred beside the two lines of text */
  .item-empty .dateline,
  .item-error .dateline {
    display: block;
    align-self: center;
    margin: 0;
  }
  /* The 404 / 403 pages carry a link under the note, so the box is levelled with the title and note
     instead of the whole block: (title + note height - box height) / 2 */
  .item-error .dateline {
    align-self: start;
    margin-top: 0.36rem;
  }
  .empty-ico {
    box-sizing: border-box;
    width: var(--rail);
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--rule);
    border-radius: var(--radius-md);
    color: var(--ink-faint);
  }
  .empty-ico svg {
    width: 1.5rem;
    height: 1.5rem;
  }
}

/* ── Short posts: plain text, marked by a small speech-bubble icon after the time ── */
.item-short .item-body p {
  position: relative;
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.55;
  letter-spacing: -0.01em;
}
.item-short .dl-time {
  display: inline-flex;
  align-items: center;
}
.sh-ic {
  flex: none;
  width: 1em;
  height: 1em;
  margin-left: 0.45em;
}

/* ── Responsive Viewports ── */
@media (max-width: 580px) {
  :root {
    --day-pad: 2.25rem;
    --post-gap: 2.5rem;
  }

  .item { 
    grid-template-columns: 1fr; 
    gap: 0.35rem 0; 
  }
  
  .dl-date {
    font-size: 0.82rem;
  }

  .dl-time {
    font-size: var(--fs-small);
  }

  .dl-count,
  .dh-count,
  .dh-time,
  .dh-n {
    font-size: var(--fs-small);
  }

  .dh-date {
    font-size: 0.82rem;
  }

  .item-body img {
    max-width: 100%;
    margin: 0;
  }

  .bullets ul, .item-body ul,
  .bullets ol, .item-body ol {
    padding-left: 1.1rem; /* Marginally tighter indentation for small displays */
  }
}

/* ── Now Block (pinned between header and feed) ── */
/* Shares --rail / --rail-gap with .item so values line up with post content. */
.now {
  padding-bottom: 2rem;
  margin-bottom: 1rem;
}

/* display:grid on rows would otherwise override the hidden attribute */
.now[hidden],
.now-row[hidden] {
  display: none;
}

.now-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.now-row {
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  gap: 0 var(--rail-gap);
  align-items: baseline;
}

.now-row dt {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}

.now-row dd {
  min-width: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink);
}

.now-by {
  color: var(--ink-mid);
}

.now-row dd.now-none {
  color: var(--ink-faint);
}

.now-ago {
  margin-left: 0.3rem;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  white-space: nowrap;
}

/* Live indicator: a tiny three-bar equalizer, shown inside the label while a
   track is actually playing. It lives in the label (not the margin), so it
   behaves the same on desktop and mobile and never changes where the track
   title starts. The middle bar is the element's own background; the outer two
   are its pseudo-elements. */
.now-live {
  position: relative;
  display: inline-block;
  width: 0.8em;                /* em: scales with the label, so it matches the cap height */
  height: 0.72em;
  margin-left: 0.45rem;
  background: linear-gradient(var(--ink-faint), var(--ink-faint)) 50% 100% / 2px 100% no-repeat;
  animation: now-eq-mid 0.9s ease-in-out infinite;
}

.now-live::before,
.now-live::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 2px;
  height: 100%;
  background: var(--ink-faint);
  transform-origin: 50% 100%;
  animation: now-eq 1s ease-in-out infinite;
}

.now-live::before { left: 0;  animation-delay: -0.35s; }
.now-live::after  { right: 0; animation-delay: -0.7s; animation-duration: 0.85s; }

@keyframes now-eq     { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
@keyframes now-eq-mid { 0%, 100% { background-size: 2px 100%; } 50% { background-size: 2px 35%; } }

/* Reduced motion: hold the bars still at uneven heights so it still reads as
   an equalizer */
@media (prefers-reduced-motion: reduce) {
  .now-live,
  .now-live::before,
  .now-live::after { animation: none; }

  .now-hist,
  .now-chev { transition: none; }

  .now-live         { background-size: 2px 100%; }
  .now-live::before { transform: scaleY(0.55); }
  .now-live::after  { transform: scaleY(0.8); }
}

/* ── Now history: expands in place under its row ── */
.now-row dt button {
  display: inline-flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
  /* Wide enough for the longest label (--now-lab, set in now.php) plus the chevron,
     so every chevron sits in the same column. */
  width: calc(var(--now-lab, 0) * (1ch + 0.04em) + 0.78rem);
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.now-row dt button:hover {
  color: var(--accent);
}

.now-row dt button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.now-chev {
  width: 0.38rem;
  height: 0.38rem;
  /* Same colour as the label; the 2px stroke matches the other icon marks */
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg) translate(-1px, -1px);
  transition: transform var(--dur-base);
  /* Baseline alignment leaves the chevron about 1px below the middle of the label's capitals */
  position: relative;
  top: -0.08rem;
}

.now-row.open .now-chev {
  transform: rotate(45deg) translate(-1px, -1px);
}

/* Slides open by animating the grid row from 0fr to 1fr; visibility keeps the
   closed list out of the tab order and away from screen readers. */
.now-hist {
  grid-column: 1 / -1;
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows var(--dur-expand) ease, visibility 0s var(--dur-expand);
}

.now-row.open .now-hist {
  grid-template-rows: 1fr;
  visibility: visible;
  transition-delay: 0s;
}

.now-hist > div {
  overflow: hidden;
  min-height: 0;
}

.now-hist-in {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.7rem 0 0.4rem;
}

/* Month sits in the rail, titles in the content column (same grid as the feed) */
.now-hist-row {
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  gap: 0 var(--rail-gap);
  align-items: baseline;
}

.now-hist-start {
  margin-top: 0.5rem;
}

.now-hist-month {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}

.now-hist-val {
  min-width: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.now-hist-val a {
  font-weight: 400;
  color: var(--ink-mid);
}

.now-hist-val a:hover {
  color: var(--accent);
}

.now-hist-val .now-by {
  color: var(--ink-faint);
}

/* "@secondary: right" in a history file: title on the left, year / season
   flush with the right edge of the content column. */
.now-hist-val.is-split {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  max-width: var(--split-width);
}

.now-hist-title {
  min-width: 0;
}

/* "@secondary: below": the year / author sits on its own line under the title */
.now-hist-val.is-stacked .now-hist-title,
.now-hist-val.is-stacked .now-hist-side {
  display: block;
}

.now-hist-val.is-stacked .now-hist-side {
  line-height: 1.4;
}

/* Author, year and season all share one style: the serif at the title's size,
   in the faint colour. (Mono stays for dates and the "12m ago" timestamp.) */
.now-hist-side {
  flex-shrink: 0;
  color: var(--ink-faint);
  white-space: nowrap;
}

/* "See all 44" under a shortened history: the month-label look (mono, micro, capitals, faint ink) */
.now-hist-val a.now-all {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.now-hist-val a.now-all:hover,
.now-hist-val a.now-all:focus-visible { color: var(--accent); }

/* A history on its own page ("See all"): the same rows, a little air under the label and a longer tail above the footer */
.now-archive { padding-bottom: 3rem; }
.now-archive .now-hist-in { padding-top: 0.75rem; }

/* The page heading: title on the left, the entries pill at the right edge, "Updated Nov 15" under the title.
   The pill matches the one on the admin history page. */
.arc-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.arc-pill {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  line-height: 1;
  color: var(--ink-faint);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.8rem;
  white-space: nowrap;
  margin-top: 0.0625rem; /* the pill's text centre sits on the capital-letter centre of the title (checked with the real fonts) */
}
.now-updated.arc-upd { margin-top: 0.6rem; padding-left: 0; }

/* A year on the archive page: the year on the left, its entry count at the right edge, a dashed line above every year after the first.
   Months with several entries and months after the first one get a little extra air. */
.arc-yh { display: flex; align-items: baseline; gap: 0.8rem; padding: 1.1rem 0 0.55rem; }
.arc-y { font-family: var(--font-serif); font-weight: 600; font-size: 1.15rem; line-height: 1.2; color: var(--ink); }
.arc-c { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-small); color: var(--ink-faint); white-space: nowrap; }
.arc-year + .arc-year { border-top: 1px dashed var(--rule); margin-top: 0.9rem; }
.arc-year .now-hist-row:last-child { margin-bottom: 0.4rem; }
.now-archive .now-hist-row.now-hist-start { margin-top: 0.8rem; }
.now-archive .now-hist-row.now-cont { margin-top: 0.55rem; }

.now-updated {
  margin-top: 1rem;
  padding-left: calc(var(--rail) + var(--rail-gap));
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

@media (max-width: 580px) {
  .now-list { gap: 0.9rem; }
  .now-row { grid-template-columns: 1fr; gap: 0.1rem 0; }
  .now-hist-row { grid-template-columns: 4.4rem 1fr; gap: 0 0.75rem; }

  /* Listening row on phones: the track and artist stay on one line and end in
     an ellipsis if they're too long, and the "33m ago" time sits on its own
     line underneath, left-aligned with the text. */
  .now-main {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .now-ago {
    display: block;
    margin-left: 0;
  }

  /* On phones the author / year goes on its own line under the title instead
     of wrapping mid-sentence. Right-aligned lists keep their layout, and a
     history file with "@secondary: inline" stays inline here too. */
  .now-hist-val:not(.is-split):not(.is-inline) .now-by {
    display: block;
    line-height: 1.4;
  }

  .now-updated { padding-left: 0; }
}

/* ── Print Profile ── */
@media print {
  body { background: #fff; color: #000; }
  header, footer, .now { display: none !important; }
  .page { max-width: 100%; padding: 0; }
}

/* ── Dark Theme ── */

/* Smooth transition when theme switches */
body, .link-card, .item-body code, .tag {
  transition: background-color var(--dur-base) ease, color var(--dur-base) ease, border-color var(--dur-base) ease;
}

/* ── Header tools: RSS link and the theme button (no outline) ── */
.header-tools {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  flex-shrink: 0;
}

.tool-btn {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--ink-faint);
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  transition: color var(--dur-base) ease;
}

.tool-btn::after { display: none !important; }

.tool-btn svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--icon-stroke, 1.5);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-btn:hover {
  color: var(--accent);
}

.tool-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* The theme button shows only the icon for the current choice */
#theme-cycle svg { display: none; }
:root[data-theme-pref="light"]  #theme-cycle .ti-light,
:root[data-theme-pref="dark"]   #theme-cycle .ti-dark,
:root:not([data-theme-pref="light"]):not([data-theme-pref="dark"]) #theme-cycle .ti-system {
  display: block;
}

@media print {
  .header-tools { display: none !important; }
}

/* ── Dark mode specific overrides ── */
[data-theme="dark"] .item-body pre code { background: none; }

[data-theme="dark"] blockquote {
  color: var(--ink-mid);
}

/* ── Header top row (title + toggle) ── */
.header-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

/* ── A short's image: a link on the pic subdomain; clicking it opens the picture in a viewer ── */
.item-body .short-pic { margin: 0.6rem 0 0; font-size: 0.84rem; line-height: 1.4; }
.item-body .short-pic-link {
  font-family: var(--font-mono);
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  border-bottom: 0;
  -webkit-tap-highlight-color: transparent;
}
.item-body .short-pic-link::after { display: none; }
.pic-lb {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: var(--bg);
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 150ms cubic-bezier(0.25, 0.1, 0.25, 1);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.pic-lb.on { opacity: 1; }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .pic-lb {
    background-color: color-mix(in srgb, var(--bg) 62%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
}
/* The enlarged picture sits in the page (not in a fixed layer), so it scrolls with the page and closing lands on the original */
.pic-lb-img {
  position: absolute;
  z-index: 1001;
  display: block;
  max-width: none;
  margin: 0;
  transform-origin: 0 0;
  cursor: zoom-out;
  transition: transform 300ms cubic-bezier(0.25, 0.1, 0.25, 1), clip-path 300ms cubic-bezier(0.25, 0.1, 0.25, 1);
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
.pic-lb-img.thumb { opacity: 0; transition: transform 300ms cubic-bezier(0.25, 0.1, 0.25, 1), opacity 150ms ease; }
.pic-lb-img.thumb.on { opacity: 1; }
.pic-lb-img.thumb.out { transition: transform 300ms cubic-bezier(0.25, 0.1, 0.25, 1), opacity 150ms ease 150ms; }
.item-body img[alt]:not([alt=""]) { cursor: zoom-in; }
/* Close button, in the same square style and hover as the back-to-top button, centred below the picture.
   site.js sets its top so it sits a set gap under the picture, on every screen size. The bottom value is only used if --lb-mode is set to fixed.
   Dragging the picture up or down also closes the viewer */
:root { --lb-close: hide; }   /* hide: no close button (tap the picture or the dark area, press Escape, or drag the picture away). Change to show to bring the button back */
.pic-lb-close {
  position: fixed;
  z-index: 1002;
  bottom: calc(var(--lb-bottom, 1.25rem) + env(safe-area-inset-bottom, 0px));
  left: 50%;
  margin-left: -1.25rem;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border-quiet);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--ink-faint);
  cursor: pointer;
  opacity: 0;
  transition: opacity 150ms ease, color var(--dur-base) ease, background-color var(--dur-base) ease, border-color var(--dur-base) ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.pic-lb-close svg { stroke-width: var(--icon-stroke, 1.5); }
.pic-lb-close.on { opacity: 1; }
.pic-lb-close:hover,
.pic-lb-close:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  background-color: color-mix(in srgb, var(--accent) 7%, var(--bg));
  outline: none;
}
@media print { .pic-lb-close { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .pic-lb, .pic-lb-img { transition: none; } }
@media print { .pic-lb, .pic-lb-img { display: none !important; } }
.item-short .item-body p.short-pic { font-size: 0.84rem; line-height: 1.4; letter-spacing: 0; margin: 1.4rem 0 0; }
.item-short .item-body > p.short-pic:first-child { margin-top: 0; }

/* ── Single post page ── */
/* The time on a post links to its own page. Colour only on hover, no underline. */
.dl-permalink {
  color: inherit;
  font-weight: inherit;
}
.dl-permalink::after { display: none; }
.dl-permalink:hover,
.dl-permalink:focus-visible { color: var(--accent); }
/* A one-post day: the date is the link to the post */
a.dl-datelink { text-decoration: none; transition: color var(--dur-base) ease; }
a.dl-datelink::after { display: none; }
a.dl-datelink:hover,
a.dl-datelink:focus-visible { color: var(--accent); }

/* On a post's own page: no "Blog" label, and the way back is a square on the footer line, on the left */
.foot-back { left: 0; right: auto; }
.foot-back[hidden] { display: none; }
.feed-single > .day:first-child { padding-top: 0.4rem; }
/* On a phone the post's own page drops the dashed line between date and time; the time stays at the right */
@media (max-width: 580px) {
  .feed-single .dl-rule { display: none; }
  .feed-single .dl-time { margin-left: auto; }
}

/* The day's other posts, listed under the post, in day order */
.day-list { padding-top: 0; }
.dn-box { min-width: 0; }
.dn-label {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.4rem;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.dn-label::after {
  content: "";
  flex: 1;
  border-bottom: 1px dashed var(--rule);
}
.dn-list { list-style: none; }
.dn-row {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  margin-inline: calc(-0.6rem - 1px);
  padding: 0.5rem 0.6rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-weight: 400;
  color: var(--ink);
}
.dn-row::after { display: none; }
.dn-time,
.dn-n {
  flex: none;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: color var(--dur-base) ease;
}
.dn-time { width: 4.9rem; }
.dn-title {
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: transparent;   /* the underline is there but invisible until you point at the row, so nothing shifts */
  transition: color var(--dur-base) ease, text-decoration-color var(--dur-base) ease;
}
/* Day list: the post you are on is the only row at full strength, in a heavier title with no underline.
   The other rows are dimmed in colour (not opacity, so the contrast is what it looks like): the title is ink mixed
   65% into the page, and the time and count keep the normal faint grey. Pointing at a row, or tabbing to it,
   brings the title, a 1px underline, the time and the count all to full ink. */
li:not([aria-current]) > .dn-row .dn-title { color: var(--ink-dim); }
li:not([aria-current]) > a.dn-row:hover .dn-title,
li:not([aria-current]) > a.dn-row:focus-visible .dn-title {
  color: var(--ink);
  text-decoration-color: var(--ink);
}
li:not([aria-current]) > a.dn-row:hover .dn-time,
li:not([aria-current]) > a.dn-row:focus-visible .dn-time,
li:not([aria-current]) > a.dn-row:hover .dn-n,
li:not([aria-current]) > a.dn-row:focus-visible .dn-n { color: var(--ink); }
a.dn-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
[aria-current] > .dn-row .dn-title { font-weight: 700; text-decoration: none; }
[aria-current] > .dn-row .dn-time,
[aria-current] > .dn-row .dn-n { color: var(--ink); }

@media (min-width: 581px) {
  .day-list {
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 1fr);
    column-gap: var(--rail-gap);
  }
  .day-list .dn-box { grid-column: 2; }
}

/* ── A short's picture: a bordered row that spans the post. The preview sits flush in its left end (the row's rounded
   corners clip it) at one fixed size, so every link starts in the same place; clicking either opens the viewer ── */
.item-short .short-pic {
  --row-bd: var(--border);   /* the control border token */
  display: flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--row-bd);
  border-radius: var(--radius-md);   /* the same as the back-to-top and back-to-blog buttons */
  background: var(--surface);
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.item-short .short-pic:hover {
  border-color: var(--ink-mid);
  background: color-mix(in srgb, var(--ink) 5%, var(--surface));
}
.sp-thumb {
  display: block;
  flex: none;
  width: 4.5rem;
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
}
.item-body .sp-thumb::after { display: none; }
.item-body img.sp-img {
  display: block;
  width: 4.5rem;
  height: 3.25rem;
  max-width: none;
  max-height: none;
  object-fit: cover;
  margin: 0;
  transform: none;
  transition: none;
  border-radius: 0;
  box-shadow: none;
  cursor: zoom-in;
}
.item-short .short-pic .sp-label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 0.5rem 0.9rem;
}

/* Pointing at the row (or its preview) gives the link the same hover as the link itself */
.item-short .short-pic:hover .sp-label,
.item-short .short-pic:has(.sp-thumb:focus-visible) .sp-label {
  text-decoration-thickness: 2px;
  text-decoration-color: var(--accent);
}

/* A short that is only a picture: on a wide screen the top of the preview lines up with the top of the date
   and time in the left column, the way a photo or video does */
@media (min-width: 581px) {
  .item.item-short:has(.item-body > .short-pic:first-child) { align-items: start; }
  @supports (text-box: trim-start cap alphabetic) {
    .item.item-short:has(.item-body > .short-pic:first-child) :is(.dl-date, .dl-time > :is(a, .dl-tt)) { text-box: trim-start cap alphabetic; }
    /* The time row also holds the speech bubble: start both at the cap line and centre the bubble on the capitals */
    .item.item-short:has(.item-body > .short-pic:first-child) .dl-time { align-items: flex-start; }
    .item.item-short:has(.item-body > .short-pic:first-child) .dl-time .sh-ic { margin-top: -0.135em; }
    .item.item-short:has(.item-body > .short-pic:first-child) .dateline { gap: 1.07rem; }
  }
  @supports not (text-box: trim-start cap alphabetic) {
    .item.item-short:has(.item-body > .short-pic:first-child) .dateline { padding-top: 0.2rem; }
  }
}

/* ── Code blocks: a slim bar with the language and a Copy button (site.js adds the bar) ── */
.codeblock {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}
.item-body .codeblock > pre { margin: 0; border: 0; border-radius: 0; background: none; padding-top: 0.9rem; }
.cb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 0.45rem 0.3rem 1.15rem;
  border-bottom: 1px solid var(--border-quiet);
}
.cb-lang { font: 500 0.68rem var(--font-mono); letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-faint); }
.cb-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 1.9rem;
  padding: 0.3rem 0.55rem;
  font: 500 0.74rem var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color var(--dur-base) ease, border-color var(--dur-base) ease;
}
.cb-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: var(--icon-stroke, 1.5); stroke-linecap: round; stroke-linejoin: round; flex: none; }
.cb-btn .ck, .cb-btn.on .cp { display: none; }
.cb-btn.on .ck { display: block; }
.cb-btn:hover, .cb-btn:focus-visible, .cb-btn.on { color: var(--accent); border-color: var(--accent); }
.cb-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 580px) { .cb-btn { min-height: 2.25rem; } }

/* ── Pinned date on every day, phone only: a single-post day's date line stays at the top
   while you read that post, like the header of a busy day. Desktop is unchanged. ── */
@media (max-width: 580px) {
  .item-post:not(.same-day-post) .dateline {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg);
    padding: 1.3rem 0 0.5rem;
    margin: -1.3rem 0 0.7rem;
  }
  .item-post:not(.same-day-post) .dateline::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 0.9rem;
    background: linear-gradient(var(--bg), transparent);
    pointer-events: none;
  }
}

/* ── A post's own page: the date and time stay put ── */
/* In the left column, the date and time used to line up with whatever the post opened with (text, a title, a card, an
   image), so they moved up and down as you stepped between posts. Now the date, the time and the first line of text or
   title all sit on one baseline, the same distance from the top for every kind of post. Cards, images and videos start
   level with the top of the date. Needs text-box (Chrome and Edge 133+, Safari 18.2+); elsewhere the page keeps the
   earlier alignment. The time sits 0.82rem under the date, a little more than it used to, so the pair has room. */
@supports (text-box: trim-start cap alphabetic) {
  @media (min-width: 581px) {
    .feed-single .item.item-post.item-post {
      --y: 1.15rem;                                   /* the shared baseline, measured from the top of the post */
      --dm: calc(var(--y) - 0.85rem * 0.73);          /* where the date's capitals start (0.73 is its cap height) */
      align-items: start;
    }
    .feed-single .item.item-post :is(.dl-date, .dl-time, .dl-time > :is(a, .dl-tt), .item-body > :is(p:not(.short-pic), h1, h2, h3, h4, .item-title, .bullets-label):first-child) {
      text-box: trim-start cap alphabetic;
    }
    .feed-single .item.item-post .dateline { gap: 1.07rem; }
    .feed-single .item.item-post .dl-date { margin-top: var(--dm); }
    .feed-single .item-short .dl-time { align-items: flex-start; }
    .feed-single .item.item-post .item-body > :is(p:not(.short-pic), h1, h2, h3, h4, .item-title, .bullets-label):first-child { margin-top: calc(var(--y) - 1cap); }
    .feed-single .item.item-post .item-body > :first-child:is(.embed-wrap, figure, img, .link-card, .short-pic),
    .feed-single .item.item-post .item-body > p:first-child:has(> img:first-child) { margin-top: var(--dm); }
  }
}

/* Icons: one lighter stroke everywhere (the stroke is a token) */
.pic-lb-close svg, .tool-btn svg, .to-top svg, .cb-btn svg { stroke-width: var(--icon-stroke, 1.5); }

/* Touch screens: a larger tap area for the small icon buttons. They look the same; only the area that responds grows. */
@media (pointer: coarse) {
  .tool-btn { position: relative; }
  .tool-btn::before { content: ""; position: absolute; inset: -0.55rem -0.05rem; }
  .to-top::before { content: ""; position: absolute; inset: -0.55rem; }
}
