/*
 * The blog's own stylesheet.
 *
 * A static file rather than a style block in the Function, so it is cached once
 * across every article instead of re-sent with each page, and so the tokens
 * below stay readable next to app/src/styles/tokens.css. It is a COPY of those
 * tokens, which is a real cost: change the palette and this drifts. The
 * alternative is the Function importing the app's CSS, which Pages Functions
 * cannot do without a build step of their own.
 */
:root {
  --glass-deep:  #0B1416;
  --glass:       #142326;
  --glass-raise: #1B2E32;
  --glass-edge:  #2A4247;
  --phosphor:    #E8F1EF;
  --phosphor-dim:#9DB3B0;
  --phosphor-mute:#6B8481;
  --tally:       #FF3B2F;
  --ready:       #4FD1A5;
  --display: 'Archivo', system-ui, sans-serif;
  --read: 'Atkinson Hyperlegible', system-ui, sans-serif;
  --data: 'DM Mono', ui-monospace, 'SF Mono', monospace;
  --radius: 3px;
  --rule: 1px solid var(--glass-edge);
}

* { box-sizing: border-box; }
body.bl {
  margin: 0;
  background: var(--glass-deep);
  color: var(--phosphor);
  font-family: var(--read);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.bl__wrap { width: min(100% - 2.5rem, 1120px); margin-inline: auto; }
.mono { font-family: var(--data); }
.eyebrow {
  font-family: var(--data); font-size: 0.68rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--phosphor-mute); margin: 0 0 0.6rem;
}
a { color: var(--phosphor); }

/* ---- site chrome, matching the app's header and footer ---- */
.bl__site { border-bottom: var(--rule); background: var(--glass-deep); }
.bl__siteinner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0; }
.bl__brand { font-family: var(--display); font-weight: 800; font-size: 1.15rem; text-decoration: none; }
.bl__nav { display: flex; align-items: center; gap: 1.4rem; }
.bl__nav a { color: var(--phosphor-dim); text-decoration: none; font-size: 0.95rem; }
.bl__nav a:hover { color: var(--phosphor); }
.bl__cta-link {
  border: var(--rule); border-radius: var(--radius); padding: 0.55rem 1rem;
  color: var(--phosphor) !important; font-weight: 700;
}
.bl__main { padding: clamp(2rem, 6vw, 4rem) 0 5rem; }

/* ---- index ---- */
.bl__top { margin-bottom: clamp(2rem, 5vw, 3rem); }
.bl__h {
  font-family: var(--display); font-weight: 800; font-stretch: 108%;
  font-size: clamp(1.9rem, 5vw, 3.1rem); line-height: 1.1; margin: 0 0 0.8rem;
}
.bl__lede { color: var(--phosphor-dim); font-size: 1.05rem; max-width: 62ch; margin: 0 0 1rem; }
.bl__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.bl__card {
  display: grid; grid-template-columns: 200px 1fr; gap: 1.2rem;
  border: var(--rule); border-radius: var(--radius); background: var(--glass);
  text-decoration: none; color: inherit; overflow: hidden;
}
.bl__card:hover { background: var(--glass-raise); }
.bl__thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.bl__cardbody { padding: 1.2rem 1.2rem 1.2rem 0; }
.bl__title { font-family: var(--display); font-weight: 700; font-size: 1.3rem; margin: 0.3rem 0 0.5rem; }
.bl__summary { color: var(--phosphor-dim); margin: 0; }
.bl__when { color: var(--phosphor-mute); font-size: 0.72rem; letter-spacing: 0.1em; margin: 0; }
.bl__muted { color: var(--phosphor-mute); }
.bl__err { color: var(--tally); font-size: 0.8rem; }

/* ---- article ---- */
.bl__article { max-width: 68ch; margin-inline: auto; }
.bl__back { margin: 0 0 1.5rem; }
.bl__back a { color: var(--phosphor-mute); text-decoration: none; font-size: 0.9rem; }
.bl__back a:hover { color: var(--phosphor); }
/*
 * Capped, because the pipeline does not control the shape of what it sends.
 * The first article arrived with a PORTRAIT photo at 1200px wide, which in a
 * 68ch column rendered about a screen and a half tall and pushed the opening
 * paragraph below the fold. A hero image introduces an article; it is not the
 * article. Cover-cropping leaves a landscape photo untouched and stops a
 * portrait one taking over.
 */
.bl__hero {
  width: 100%; height: auto; max-height: 420px; object-fit: cover;
  border-radius: var(--radius);
  border: var(--rule); margin: 1.5rem 0 2rem; display: block;
}
.bl__thumb { max-height: 240px; }
.bl__body { font-size: 1.08rem; }
.bl__body h2 {
  font-family: var(--display); font-weight: 700; font-size: 1.5rem;
  margin: 2.4rem 0 0.8rem; line-height: 1.2;
}
.bl__body h3 { font-family: var(--display); font-weight: 700; font-size: 1.2rem; margin: 2rem 0 0.6rem; }
.bl__body p { margin: 0 0 1.2rem; }
.bl__body ul, .bl__body ol { margin: 0 0 1.2rem; padding-left: 1.3rem; }
.bl__body li { margin-bottom: 0.5rem; }
.bl__body img { max-width: 100%; height: auto; border-radius: var(--radius); }
.bl__body blockquote {
  margin: 1.6rem 0; padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 2px solid var(--glass-edge); color: var(--phosphor-dim);
}
.bl__body code {
  font-family: var(--data); font-size: 0.9em;
  background: var(--glass); border: var(--rule); border-radius: var(--radius); padding: 0.1rem 0.35rem;
}
.bl__body pre {
  background: var(--glass); border: var(--rule); border-radius: var(--radius);
  padding: 1rem; overflow-x: auto;
}
.bl__body pre code { border: 0; background: none; padding: 0; }
/* A wide table must scroll inside itself rather than widening the page. */
.bl__body table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.bl__body th, .bl__body td { border: var(--rule); padding: 0.5rem 0.7rem; text-align: left; }

.bl__cta {
  max-width: 68ch; margin: 4rem auto 0; padding: 2rem;
  border: var(--rule); border-radius: var(--radius); background: var(--glass); text-align: center;
}
.bl__cta h2 { font-family: var(--display); font-weight: 800; margin: 0 0 0.5rem; }
.bl__cta p { color: var(--phosphor-dim); margin: 0 0 1.4rem; }
.btn {
  display: inline-block; background: var(--phosphor); color: var(--glass-deep);
  font-family: var(--display); font-weight: 700; text-decoration: none;
  padding: 0.75rem 1.4rem; border-radius: var(--radius);
}

.bl__empty { text-align: center; padding: 4rem 0; }

/* ---- footer ---- */
.bl__foot { border-top: var(--rule); padding: 2.5rem 0; margin-top: 4rem; }
.bl__footnav { display: flex; flex-wrap: wrap; gap: 1.2rem; margin: 1rem 0; }
.bl__footnav a { color: var(--phosphor-dim); text-decoration: none; font-size: 0.92rem; }
.bl__footnav a:hover { color: var(--phosphor); }
.bl__copy { font-size: 0.85rem; }

@media (max-width: 640px) {
  .bl__card { grid-template-columns: 1fr; }
  .bl__thumb { height: 180px; }
  .bl__cardbody { padding: 0 1.2rem 1.2rem; }
  .bl__nav { gap: 0.9rem; font-size: 0.9rem; }
}

/* ---------- changelog ----------
   The index is a list of summaries: no thumbnails, so it does not use the
   blog's two-column card. Everything else (wrap, headings, body prose, back
   link) is the blog's, because they are the same kind of page. */
.cl__card {
  position: relative;                 /* the anchor's ::after is measured off this */
  border: var(--rule); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; margin-bottom: 0.9rem; background: var(--glass);
  cursor: pointer;
}
.cl__card:hover { background: var(--glass-raise); }
/* Keyboard users tab to the title link, so the ring has to show on the card. */
.cl__card:focus-within { outline: 2px solid var(--ready); outline-offset: 2px; }
.cl__meta {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  margin: 0 0 0.4rem;
  font-family: var(--data); font-size: 0.68rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--phosphor-mute);
}
.cl__tag {
  border: var(--rule); border-radius: 999px; padding: 0.1rem 0.5rem;
  color: var(--ready);
}
.cl__title { margin: 0 0 0.5rem; font-size: 1.25rem; line-height: 1.25; }
.cl__title a { color: var(--phosphor); text-decoration: none; }
.cl__title a:hover { text-decoration: underline; }
/* The stretched link: the anchor covers the whole card, so a click anywhere on
   it opens the entry, with none of the tab order or middle-click behaviour you
   lose by putting a click handler on the container instead. */
.cl__title a::after { content: ""; position: absolute; inset: 0; }
.cl__title a:focus-visible { outline: none; }   /* the card carries the ring */
.cl__more {
  display: inline-block; margin-top: 0.7rem;
  font-family: var(--data); font-size: 0.68rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--phosphor-dim); text-decoration: none;
  border: var(--rule); border-radius: 999px; padding: 0.3rem 0.8rem;
}
.cl__card:hover .cl__more { color: var(--phosphor); border-color: var(--phosphor-mute); }

/* Older and newer, so an entry is never a dead end. */
.cl__pager {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin: 2rem 0 1rem; padding-top: 1.2rem; border-top: var(--rule);
}
.cl__pager a { color: var(--phosphor-dim); text-decoration: none; font-size: 0.9rem; max-width: 24ch; }
.cl__pager a:hover { color: var(--phosphor); }
