/* post.css — owned by the design-loop piece for this surface.
   Tokens live in blog.css and are inherited; never redeclare them here.

   Composition: one narrow centred measure (580px ≈ 67 characters) inside the
   1120px container, with a single wider track (840px) that every figure —
   image, code block, table, pull quote, diagram, contents index, closing CTA —
   breaks out into. Nothing else escapes the measure. Type sizes are the
   existing scale re-assigned, not extended: 76 / 60 / 34 / 21 / 18 / 15 / 14 / 12.
   ========================================================================= */

/* ---------- Shell ---------- */

.post {
  padding: 96px 0 120px;
}

/* The measure is centred inside the standard 1120px container rather than a
   narrow wrapper, so figures have room to break out on both sides. */
.post-container {
  max-width: 1120px;
}

/* Every block in the article is centred at the measure. Breakout elements
   below raise their own max-width; nothing else does. */
.post-header > *,
.post-content > *,
.post-toc,
.post-tags,
.post-footer {
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Masthead ---------- */

/* blog.css styles the bare `nav` element as the fixed site header. The
   breadcrumb is also a <nav> — semantically correct, and worth keeping for the
   BreadcrumbList below — so it has to opt out of that chrome explicitly. */
.post-crumb {
  position: static;
  z-index: auto;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
  display: block;
  max-width: 680px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--secondary-text);
  margin-bottom: 40px;
}

.post-crumb a {
  color: var(--secondary-text);
  text-decoration: none;
  transition: color 0.16s var(--ease);
}

.post-crumb a:hover { color: var(--light-text); }

.post-crumb-sep {
  display: inline-block;
  margin: 0 10px;
  opacity: 0.45;
}

.post-header .post-title {
  max-width: 680px;
  text-align: center;
  text-wrap: balance;
  font-family: var(--font-display);
  font-size: 60px;
  font-weight: 500;
  letter-spacing: -0.032em;
  line-height: 1.02;
  color: var(--light-text);
  margin-bottom: 0;
}

/* Hero figure, when a post supplies one. It sits above the byline: the image
   is the anchor, the attribution is the caption for it. */
.post-hero {
  max-width: 680px;
  margin-top: 56px;
  margin-bottom: 0;
}

.post-hero img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-md);
  box-shadow: var(--edge);
}

.post-hero figcaption {
  margin-top: 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--secondary-text);
}

/* ---------- Generated hero figure ----------

   When a post has no `image`, layouts/partials/post-figure.html draws the same
   line figure the blog index printed on that post's card — same seed, same
   geometry, twice the size. It stays on the 680px measure: the figure is a
   surface, not a full-bleed band, so the article keeps one left edge from
   breadcrumb to footer.

   Only the stroke weight differs from the card. Scaling a 320-unit viewBox to
   680px doubles a 1px hairline into a 2px line, which reads as a marker
   drawing rather than a diagram, so the hero draws thinner in user units and
   lands back at roughly a hairline on screen. */

.post-hero-fig {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--edge);
  overflow: hidden;
}

.post-hero-fig .pfig {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.88;
}

.post-hero-fig .fig-s,
.post-hero-fig .fig-w { stroke-width: 0.7; }

/* Ink vocabulary. Four weights, monochrome: the figures never carry an accent
   or a severity hue. Duplicated from blog-index.css because the two surface
   stylesheets are deliberately independent — post pages never load the index
   sheet. */
.fig-s {
  fill: none;
  stroke: var(--secondary-text);
  stroke-opacity: 0.58;
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fig-w {
  fill: none;
  stroke: var(--secondary-text);
  stroke-opacity: 0.3;
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fig-d {
  fill: var(--secondary-text);
  fill-opacity: 0.6;
  stroke: none;
}

.fig-g {
  fill: none;
  stroke: var(--secondary-text);
  stroke-opacity: 0.26;
  stroke-width: 1;
  stroke-linecap: butt;
}

.post-header .post-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  max-width: 680px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--secondary-text);
  margin-top: 44px;
  margin-bottom: 0;
}

.post-header .post-byline .post-meta-sep { opacity: 0.45; }

/* Standfirst. Distinct from body copy on three axes at once: larger, italic,
   and set in the primary text colour where body copy is secondary. */
.post-header .post-lede {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.012em;
  line-height: 1.5;
  color: var(--light-text);
  text-wrap: pretty;
  border-left: none;
  padding-left: 0;
  margin-top: 64px;
  margin-bottom: 0;
}

.post-header {
  margin-bottom: 56px;
}

/* ---------- Contents index ---------- */

.post-toc {
  max-width: 680px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 24px 0 26px;
  margin-bottom: 64px;
}

.post-toc-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--secondary-text);
  margin-bottom: 14px;
}

/* Hugo wraps .TableOfContents in its own <nav id="TableOfContents">, which
   would otherwise pick up the fixed site-header chrome blog.css puts on `nav`. */
.post-toc nav,
.post-content nav {
  position: static;
  z-index: auto;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
}

.post-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 2;
  column-gap: 48px;
}

.post-toc li {
  margin: 0 0 8px;
  break-inside: avoid;
}

.post-toc ul ul { display: none; }

.post-toc a {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 400;
  color: var(--secondary-text);
  text-decoration: none;
  transition: color 0.16s var(--ease);
}

.post-toc a:hover { color: var(--light-text); }

/* ---------- Body ---------- */

.post-content {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.75;
  color: var(--secondary-text);
}

.post-content p { color: var(--secondary-text); }
.post-content ul,
.post-content ol { color: var(--secondary-text); }
.post-content li::marker { color: var(--secondary-text); }

.post-content > * + * { margin-top: 1.3em; }

/* Section break: a hairline across the measure, then the heading. */
.post-content h2 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.032em;
  line-height: 1.03;
  color: var(--light-text);
  text-wrap: balance;
  border-top: 1px solid var(--border);
  padding-top: 44px;
  margin-top: 96px;
  margin-bottom: 32px;
}

.post-content h3 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.026em;
  line-height: 1.15;
  color: var(--light-text);
  text-wrap: balance;
  margin-top: 64px;
  margin-bottom: 20px;
}

.post-content h4 {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--light-text);
  margin-top: 48px;
  margin-bottom: 12px;
}

.post-content strong { color: var(--light-text); font-weight: 600; }
.post-content em { color: var(--light-text); }

.post-content a {
  color: var(--lavender);
  text-decoration: underline;
  text-decoration-color: var(--border-hover);
  text-underline-offset: 3px;
  transition: color 0.16s var(--ease), text-decoration-color 0.16s var(--ease);
}

.post-content a:hover {
  color: var(--light-text);
  text-decoration-color: var(--border-hover);
}

/* Rules the author writes are section breaks, and span the measure. */
.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin-top: 72px;
  margin-bottom: 72px;
}

/* ---------- Figures: everything below breaks the measure ---------- */

.post-content > pre,
.post-content > .highlight,
.post-content > blockquote,
.post-content > table,
.post-content > figure,
.post-content > .diagram-figure,
.post-content > p:has(> img:only-child),
.post-content > p > img,
.post-content > img {
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

/* blog.css sets `margin: <n>em 0` shorthands on these at higher specificity than
   `.post-content > *`, which would zero the auto side-margins that centre the
   breakout track. Re-assert them at matching specificity, later in the cascade. */
.post-content .highlight,
.post-content .diagram-figure,
.post-content pre,
.post-content blockquote,
.post-content table,
.post-content figure,
.post-content hr {
  margin-left: auto;
  margin-right: auto;
}

.post-content > p:has(> img:only-child) { margin-left: auto; margin-right: auto; }

.post-content img {
  display: block;
  width: 100%;
  max-width: 680px;
  height: auto;
  margin-left: auto;
  margin-right: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  margin-top: 3em;
  margin-bottom: 3em;
}

.post-content .diagram-figure {
  max-width: 680px;
  margin-top: 3em;
  margin-bottom: 3em;
}

/* Pull quote. Hairlines run the full breakout width so the quote visibly
   opens past the measure on both sides; the quoted line itself stays
   readable at 700px. */
.post-content blockquote {
  max-width: 680px;
  border-left: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 40px 0;
  margin-top: 3em;
  margin-bottom: 3em;
  font-style: normal;
}

.post-content blockquote > * {
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.post-content blockquote p {
  font-size: 21px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.012em;
  line-height: 1.5;
  color: var(--light-text);
  text-wrap: pretty;
}

.post-content blockquote p + p { margin-top: 0.8em; }

/* Tables */
.post-content table {
  width: 100%;
  max-width: 680px;
  margin-top: 3em;
  margin-bottom: 3em;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.5;
  color: var(--secondary-text);
}

.post-content th,
.post-content td {
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
}

.post-content th {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--secondary-text);
  background: none;
  border-bottom-color: var(--border-hover);
}

.post-content td { color: var(--secondary-text); }
.post-content tr td:first-child { color: var(--light-text); }

/* ---------- Code ---------- */

.post-content :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--light-text);
  padding: 1px 6px;
  border-radius: var(--r-sm);
}

.post-content .highlight {
  max-width: 680px;
  margin-top: 3em;
  margin-bottom: 3em;
  border-radius: var(--r-md);
  overflow: hidden;
}

.post-content pre,
.post-content .highlight pre {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 24px 26px;
  overflow-x: auto;
  margin-top: 3em;
  margin-bottom: 3em;
}

.post-content .highlight pre {
  margin-top: 0;
  margin-bottom: 0;
}

/* Chroma runs with noClasses=true and the "dracula" style, so every token
   arrives as an inline `style="color:#ff79c6"` on a <span>. Inline styles beat
   ordinary rules, so the reset below is `!important` — important author
   declarations outrank the style attribute in the cascade, which ordinary
   declarations do not. Two passes:
     1. a catch-all that strips colour, background and weight from every
        styled span (but leaves `display:flex` on Chroma's line wrappers, which
        is why this targets colour properties rather than resetting `all`);
     2. the dracula hexes we know Chroma emits, remapped onto a two-step
        neutral ramp so code keeps its comment//code distinction with zero
        saturated pixels.
   Equal specificity between the two passes, so pass 2 wins on source order. */
.post-content .highlight,
.post-content .highlight pre,
.post-content pre,
.post-content pre code {
  background-color: var(--surface) !important;
  background-image: none !important;
  color: var(--light-text) !important;
}

.post-content pre span[style],
.post-content pre code span[style] {
  color: inherit !important;
  background-color: transparent !important;
  background-image: none !important;
  font-weight: 400 !important;
  font-style: normal !important;
  text-decoration: none !important;
}

/* dracula: comment #6272a4, string #f1fa8c, char/number #bd93f9,
   keyword/operator #ff79c6, name/function #50fa7b, type #8be9fd,
   deleted #ff5555, inserted #50fa7b, other #ffb86c, text #f8f8f2 */
.post-content pre span[style*="#6272a4"],
.post-content pre span[style*="#f1fa8c"],
.post-content pre span[style*="#ffb86c"] {
  color: var(--secondary-text) !important;
}

.post-content pre span[style*="#ff79c6"],
.post-content pre span[style*="#bd93f9"],
.post-content pre span[style*="#8be9fd"],
.post-content pre span[style*="#50fa7b"],
.post-content pre span[style*="#ff5555"],
.post-content pre span[style*="#f8f8f2"] {
  color: var(--light-text) !important;
}

.post-content pre code {
  background: none !important;
  border: none;
  padding: 0;
  font-size: inherit;
}

/* ---------- Topics + closing ---------- */

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 680px;
  margin-top: 80px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.post-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--secondary-text);
  background: rgba(109, 60, 200, 0.12);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 4px 12px;
}

.post-footer {
  max-width: 680px;
  margin-top: 72px;
  padding-top: 0;
  border-top: none;
}

/* The closing card is a surface with a hairline, not a tinted gradient —
   the gradient put a large indigo wash into every screenshot of a post tail. */
.post-cta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 56px 48px;
  text-align: center;
}

.post-cta h3 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.026em;
  line-height: 1.1;
  color: var(--light-text);
  margin-bottom: 16px;
  text-wrap: balance;
}

.post-cta p {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  color: var(--secondary-text);
  font-size: 16px;
  margin-bottom: 28px;
}

/* ---------- Responsive ---------- */

@media (max-width: 680px) {
  .post { padding: 72px 0 96px; }
  .post-header .post-title { font-size: 44px; }
  .post-content h2 { font-size: 28px; margin-top: 80px; padding-top: 36px; }
  .post-content h3 { font-size: 21px; }
}

@media (max-width: 900px) {
  .post { padding: 56px 0 80px; }
  .post-header .post-title { font-size: 44px; }
  .post-header .post-lede { font-size: 19px; margin-top: 40px; }
  .post-header .post-byline { margin-top: 32px; }
  .post-content { font-size: 17px; }
  .post-content h2 { font-size: 38px; margin-top: 64px; padding-top: 32px; margin-bottom: 24px; }
  .post-content h3 { font-size: 21px; font-weight: 600; }
  .post-content blockquote p { font-size: 19px; }
  .post-toc ul { columns: 1; }
  .post-cta { padding: 36px 24px; }
  .post-cta h3 { font-size: 34px; }
}

/* Tags became anchors when taxonomy hubs were enabled. Without this they
   inherit the prose link treatment (lavender + underline) and the chip row
   turns into a line of coloured links, spending accent on navigation. */
.post-tags a.post-tag {
  color: var(--secondary-text);
  text-decoration: none;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.post-tags a.post-tag:hover {
  color: var(--light-text);
  border-color: var(--border-hover);
}
