/* The blog and showcase pages the platform renders for codeartworks.com, and the editor's preview of them. Every rule is scoped to a class,
   so the back office can load this file next to site.css; content-page.css adds the page base the public pages need. */
:root {
  --on-accent: #2b3315;
  --sans: 'IBM Plex Sans', 'IBM Plex Sans Fallback', system-ui, sans-serif;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow a {
  color: inherit;
  text-decoration: none;
}

.eyebrow a:hover {
  color: var(--ink);
}

.section-title {
  margin: 16px 0 0;
  font-size: clamp(30px, 3vw, 40px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background-color 0.15s ease,
    transform 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-xl {
  min-height: 52px;
  padding: 16px 28px;
  font-size: 17px;
  font-weight: 600;
}

.btn-dark {
  background: var(--ink);
  color: var(--accent);
}

.btn-dark:hover {
  background: var(--ink-hover);
  color: var(--accent);
}

.section {
  border-top: 1px solid var(--line);
}

.section.surface {
  background: var(--surface);
}

.section > .container {
  padding-block: var(--section-pad);
}

.cta-band {
  background: var(--accent);
  color: var(--ink);
}

.cta-band > .container {
  padding-block: var(--section-pad);
  display: flex;
  flex-wrap: wrap;
  gap: 32px 64px;
  align-items: flex-end;
  justify-content: space-between;
}

.cta-band .copy {
  flex: 1 1 560px;
  min-width: 0;
}

.cta-band .eyebrow {
  color: var(--accent-ink);
}

.cta-band h2 {
  margin: 16px 0 0;
  font-size: clamp(36px, 4.4vw, 60px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.cta-band p {
  margin: 20px 0 0;
  max-width: 560px;
  font-size: 18px;
  color: var(--on-accent);
}

/* Blog */

.blog-wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.blog-hero {
  padding-block: var(--section-pad-sm) 56px;
}

.blog-hero h1 {
  margin: 16px 0 0;
  font-size: clamp(44px, 6vw, 80px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.04em;
  overflow-wrap: break-word;
}

.blog-hero h1 mark {
  padding: 0 0.08em 0.04em;
  background: var(--accent);
  color: inherit;
}

.blog-hero p {
  margin: 24px 0 0;
  max-width: 720px;
  font-size: 20px;
  line-height: 1.5;
  color: var(--ink-body);
}

.content-error {
  padding-bottom: var(--section-pad);
}

.content-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

.content-error-actions .btn:not(.btn-dark) {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.posts {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.related-posts {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.related-posts > .blog-wrap > h2 {
  margin: 0;
  padding-top: 56px;
  font-size: 24px;
  letter-spacing: -0.01em;
}

.related-posts .posts {
  border-top: 0;
}

.related-posts .post-grid {
  padding-top: 28px;
}

.post-grid {
  list-style: none;
  margin: 0;
  padding: 64px 0 var(--section-pad);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 40px;
}

.posts-empty {
  margin: 0;
  padding: 64px 0 var(--section-pad);
  font-size: 18px;
  color: var(--ink-2);
}

.post-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.post-card-cover {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-sunken);
}

.post-card-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card-cover.plain {
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, var(--bg-sunken), color-mix(in srgb, var(--accent) 14%, var(--bg-sunken)));
  text-decoration: none;
}

.post-card-cover.plain span {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.post-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 24px;
}

.post-card h2 {
  margin: 12px 0 0;
  overflow-wrap: break-word;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.post-card h2 a {
  color: var(--ink);
  text-decoration: none;
  background: linear-gradient(var(--accent), var(--accent)) no-repeat 0 100% / 0 3px;
  transition: background-size 0.2s ease;
}

.post-card h2 a:hover {
  background-size: 100% 3px;
}

.post-card p {
  margin: 12px 0 0;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-2);
}

/* The author over the tags, pinned to the card's foot, so every card in a row puts them in the same place whatever its text. */
.post-card-body > p {
  margin-bottom: 24px;
}

.post-card-foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.post-author {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.draft-badge {
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: var(--ink);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.tag:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}

.post-header {
  padding-block: 72px 48px;
}

.post-header h1 {
  margin: 16px 0 0;
  max-width: 960px;
  overflow-wrap: break-word;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.post-header .lede {
  margin: 24px 0 0;
  max-width: 760px;
  font-size: 21px;
  line-height: 1.5;
  color: var(--ink-body);
}

.post-header .post-meta {
  margin-top: 28px;
}

.post-header .tag-list {
  margin-top: 20px;
}

.post-cover {
  margin: 0 0 56px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-sunken);
}

.post-cover img {
  display: block;
  width: 100%;
  height: auto;
}

.post-section {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 720px) minmax(0, 260px);
  justify-content: space-between;
  gap: 56px;
  padding-block: 64px 96px;
}

.post-layout.no-toc {
  grid-template-columns: minmax(0, 720px);
}

.toc {
  position: sticky;
  top: 24px;
  align-self: start;
  order: 2;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--accent);
}

.toc ol {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.toc li {
  margin: 0;
}

.toc li.depth-3 {
  padding-left: 14px;
}

.toc a {
  display: block;
  padding: 5px 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink-2);
  text-decoration: none;
}

.toc a:hover {
  color: var(--ink);
}

:is(.post-body, .showcase-body) {
  min-width: 0;
  overflow-wrap: break-word;
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink-body);
}

/* A showcase's published headings sit a level below the post's (under its h2 title); its editor still writes h2 and h3. */
.post-body h2,
.showcase-body h3,
.showcase-body:where(.ProseMirror) h2 {
  margin: 56px 0 0;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  scroll-margin-top: 24px;
}

.post-body h3,
.showcase-body h4,
.showcase-body:where(.ProseMirror) h3 {
  margin: 40px 0 0;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: normal;
  color: var(--ink);
  scroll-margin-top: 24px;
}

.showcase-body h3,
.showcase-body:where(.ProseMirror) h2 {
  margin-top: 40px;
  font-size: 24px;
}

.showcase-body h4,
.showcase-body:where(.ProseMirror) h3 {
  margin-top: 32px;
  font-size: 20px;
}

:is(.post-body, .showcase-body) :is(p, ul, ol, blockquote, pre, figure, table) {
  margin: 20px 0 0;
}

:is(.post-body, .showcase-body) :is(ul, ol) {
  padding-left: 24px;
}

:is(.post-body, .showcase-body) li + li {
  margin-top: 8px;
}

:is(.post-body, .showcase-body) a {
  color: var(--ink);
  text-decoration-color: var(--line-field);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

:is(.post-body, .showcase-body) a:hover {
  text-decoration-color: var(--accent);
  text-decoration-thickness: 3px;
}

:is(.post-body, .showcase-body) strong {
  color: var(--ink);
  font-weight: 600;
}

:is(.post-body, .showcase-body) img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

:is(.post-body, .showcase-body) figure {
  margin-inline: 0;
}

:is(.post-body, .showcase-body) figcaption {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}

:is(.post-body, .showcase-body) blockquote {
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--ink-2);
}

:is(.post-body, .showcase-body) code {
  padding: 1px 5px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
  background: var(--bg);
  font-family: var(--mono);
  font-size: 0.88em;
}

:is(.post-body, .showcase-body) pre {
  overflow-x: auto;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--dark);
  color: var(--dark-code);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
}

:is(.post-body, .showcase-body) pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
}

:is(.post-body, .showcase-body) .code-box {
  margin: 1.4em 0;
}

/* After the code block's own margin, so a text that opens with one starts flush; the writer's later editor rules still win. */
:is(.post-body, .showcase-body) > :first-child {
  margin-top: 0;
}

:is(.post-body, .showcase-body) .code-box pre {
  margin: 0;
}

.toc a[aria-current='location'] {
  color: var(--ink);
  font-weight: 600;
}

:is(.post-body, .showcase-body) hr {
  margin: 48px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

/* The renderer wraps each table, so one wider than the column scrolls inside its box instead of widening the page. */
:is(.post-body, .showcase-body) .table-wrap {
  margin: 20px 0 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

:is(.post-body, .showcase-body) table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.5;
}

:is(.post-body, .showcase-body) :is(th, td) {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

:is(.post-body, .showcase-body) tr:last-child :is(th, td) {
  border-bottom: 0;
}

:is(.post-body, .showcase-body) thead th {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
}

:is(.post-body, .showcase-body) tbody td:first-child {
  min-width: 120px;
  font-weight: 500;
  color: var(--ink);
}

:is(.post-body, .showcase-body) tr.highlight :is(th, td) {
  background: #f3f8e4;
}

/* "## 01 Results": the number set apart in mono before the title, and each numbered section ruled off from the one before it. */
.post-body h2[data-number]::before,
.showcase-body h3[data-number]::before {
  content: attr(data-number);
  margin-right: 12px;
  font-family: var(--mono);
  font-size: 0.6em;
  font-weight: 500;
  vertical-align: 0.2em;
  color: var(--muted);
}

.post-body h2[data-number]:not(:first-child) {
  margin-top: 72px;
  padding-top: 72px;
  border-top: 1px solid var(--line);
}

:is(.post-body, .showcase-body) p.fine {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

:is(.post-body, .showcase-body) p.fine em {
  font-style: normal;
}

/* A quote opening with a bold line is a note under that label (the dashed box); one holding figures is set out beside them. */
:is(.post-body, .showcase-body) blockquote.callout {
  padding: 24px 28px;
  border: 1px dashed #a3a69e;
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink-body);
}

:is(.post-body, .showcase-body) blockquote.callout > :first-child {
  margin-top: 0;
}

:is(.post-body, .showcase-body) blockquote.callout p {
  font-size: 16px;
  line-height: 1.6;
}

:is(.post-body, .showcase-body) blockquote.callout .callout-label strong {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

:is(.post-body, .showcase-body) blockquote.callout :is(h2, h3, h4) {
  margin-top: 8px;
  font-size: 22px;
  line-height: 1.25;
}

:is(.post-body, .showcase-body) blockquote.callout .callout-label + :is(h2, h3, h4) {
  margin-top: 6px;
}

.showcase-body blockquote.feature {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 0 32px;
  align-items: center;
}

.showcase-body blockquote.feature > * {
  grid-column: 1;
}

.showcase-body blockquote.feature > .chart {
  grid-column: 2;
  grid-row: 1 / span 20;
  margin-top: 0;
}

/* The side column holds one chart; with more, each one would claim the same cell, so they stack in the text's column instead. */
.showcase-body blockquote.feature:has(> .chart ~ .chart) {
  grid-template-columns: minmax(0, 1fr);
}

.showcase-body blockquote.feature:has(> .chart ~ .chart) > .chart {
  grid-column: 1;
  grid-row: auto;
  margin-top: 28px;
}

/* stats: figures on cards in one row, the bold one in the accent's dark green; inside a note they stand as big open figures. */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  margin: 32px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  overflow: hidden;
}

.stat-card {
  padding: 20px;
  background: var(--surface);
}

/* Two to a row on a phone; an odd last figure takes the whole row instead of leaving a grey gap beside it. */
@media (max-width: 560px) {
  .stat-cards {
    grid-template-columns: 1fr 1fr;
  }

  .stat-card:nth-child(odd):last-child {
    grid-column: 1 / -1;
  }
}

.stat-card dt {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-card dd {
  margin: 0;
}

.stat-value {
  margin-top: 8px !important;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.stat-card.accent .stat-value {
  color: #4a7000;
}

.stat-note {
  margin-top: 6px !important;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

.callout .stat-cards {
  grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
  gap: 16px 40px;
  margin-top: 18px;
  border: 0;
  background: none;
}

.callout .stat-card {
  padding: 0;
  background: none;
}

.callout .stat-card dt {
  display: none;
}

.callout .stat-value {
  margin-top: 0 !important;
  font-size: 44px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #4a7000;
}

.callout .stat-note {
  max-width: 240px;
}

/* chart: bars on a rounded axis. Heights and positions come from the p-N classes below. */
.chart {
  margin: 32px 0 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.chart-kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.chart-title {
  margin-top: 6px;
  font-size: 17px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--ink);
}

.chart-title span {
  font-weight: 400;
  color: var(--muted);
}

.chart-kicker + .chart-plot,
.chart-title + .chart-plot,
.chart-axis-label + .chart-plot {
  margin-top: 36px;
}

.chart-axis-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

:is(.chart-kicker, .chart-title) + .chart-axis-label {
  margin-top: 20px;
}

.chart-plot {
  position: relative;
  padding-left: 48px;
}

.chart-axis {
  position: absolute;
  top: 0;
  left: 0;
  width: 40px;
  height: 260px;
}

.chart-axis span {
  position: absolute;
  right: 0;
  bottom: var(--p);
  transform: translateY(50%);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.chart-bars {
  position: relative;
  display: flex;
  justify-content: space-around;
  gap: 16px;
  height: 260px;
  border-bottom: 1px solid var(--line-field);
}

.chart-grid {
  position: absolute;
  right: 0;
  bottom: var(--p);
  left: 0;
  border-top: 1px dashed var(--line-soft);
}

.chart-col {
  position: relative;
  display: flex;
  flex: 0 1 112px;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
}

.chart-bar {
  position: relative;
  height: var(--p);
  min-height: 4px;
  border-radius: 4px 4px 0 0;
  background: #8a8d85;
}

.chart-bar.accent {
  background: #4a7000;
}

.chart-bar.hatched {
  background: repeating-linear-gradient(135deg, #4a7000 0 6px, #6e9530 6px 9px);
}

.chart-bar b {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -6px);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.chart-label {
  position: absolute;
  top: calc(100% + 10px);
  right: -8px;
  left: -8px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  color: var(--ink);
}

.chart-label small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.chart-plot {
  margin-bottom: 64px;
}

.chart figcaption {
  margin-top: 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-body);
  text-align: left;
}

.callout .chart {
  padding: 20px;
}

.callout .chart-axis,
.callout .chart-bars {
  height: 180px;
}

/* chart, type horizontal: a row per bar, its label to the left and its value at the bar's end. */
.chart-kicker + .chart-rows,
.chart-title + .chart-rows,
.chart-axis-label + .chart-rows {
  margin-top: 24px;
}

.chart-rows {
  display: grid;
  gap: 14px;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(96px, 32%) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.chart-row .chart-label {
  position: static;
  text-align: right;
}

.chart-track {
  position: relative;
  height: 32px;
  margin-right: 72px;
}

.chart-row .chart-bar {
  display: block;
  width: var(--p);
  height: 100%;
  min-width: 4px;
  border-radius: 0 4px 4px 0;
}

.chart-row .chart-bar b {
  bottom: auto;
  top: 50%;
  left: 100%;
  transform: translate(8px, -50%);
}

/* chart, type line: an SVG drawn in viewBox units, so its text sizes are relative to a 640-unit width. */
.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart.line .chart-plot {
  padding-left: 0;
  margin-bottom: 8px;
}

.chart-gridline {
  stroke: var(--line-soft);
  stroke-dasharray: 4 4;
}

.chart-tick {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-anchor: end;
  dominant-baseline: middle;
}

.chart-path {
  fill: none;
  stroke: #8a8d85;
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-point {
  fill: var(--surface);
  stroke: #8a8d85;
  stroke-width: 3;
}

.chart-point.accent {
  fill: #4a7000;
  stroke: #4a7000;
}

.chart-value {
  fill: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-anchor: middle;
}

.chart-value.accent {
  fill: #4a7000;
}

.chart-x {
  fill: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-anchor: middle;
}

/* video: a library video with its caption and, folded away, its transcript. */
.content-video {
  margin: 32px 0 0;
}

.content-video video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  background: var(--dark);
}

.content-transcript {
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-body);
}

.content-transcript summary {
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

.content-transcript p {
  margin-top: 8px;
}

/* gallery: up to three across, cropped to one shape so the rows line up. */
.content-gallery {
  display: grid;
  gap: 14px;
  margin-top: 32px;
}

.content-gallery.g-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.content-gallery.g-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.content-gallery figure {
  margin: 0;
}

.content-gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
}

.content-gallery.g-1 img {
  aspect-ratio: auto;
}

.content-gallery figcaption {
  margin-top: 8px;
  font-size: 14px;
  text-align: left;
}

/* compare: two labelled pictures; content.js stacks them and clips the second at the divider (--split). */
.content-compare {
  margin: 32px 0 0;
}

.compare-stage {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.compare-side {
  position: relative;
}

.compare-side img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.compare-side span {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  background: rgba(22, 25, 15, 0.8);
  color: #ffffff;
  font: 500 11.5px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.content-compare.is-live .compare-stage {
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
}

.content-compare.is-live .compare-side img {
  border-radius: 0;
}

.content-compare.is-live .compare-after {
  position: absolute;
  inset: 0;
  clip-path: inset(0 0 0 var(--split, 50%));
}

.content-compare.is-live .compare-after img {
  height: 100%;
  object-fit: cover;
}

.content-compare.is-live .compare-after span {
  right: 12px;
  left: auto;
}

.content-compare.is-live .compare-stage::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--split, 50%);
  width: 3px;
  margin-left: -1.5px;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(22, 25, 15, 0.25);
  pointer-events: none;
}

.content-compare.is-live .compare-stage::before {
  content: '';
  position: absolute;
  top: 50%;
  left: var(--split, 50%);
  z-index: 2;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border-radius: 50%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2316190f' d='m8 7-5 5 5 5V7zm8 0v10l5-5-5-5z'/%3E%3C/svg%3E")
      center / 22px no-repeat,
    #ffffff;
  box-shadow: 0 2px 10px rgba(22, 25, 15, 0.35);
  pointer-events: none;
}

:is(.post-body, .showcase-body) :is(.content-video, .content-compare, .content-diagram) {
  margin-top: 32px;
}

.compare-range {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}

.content-compare.is-live:has(.compare-range:focus-visible) .compare-stage {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* columns: two or three columns of ordinary text that stack on phones. */
.content-columns {
  display: grid;
  gap: 32px;
  margin-top: 32px;
}

.content-columns.c-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.content-columns.c-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.content-column p {
  white-space: pre-line;
}

.content-column > :first-child {
  margin-top: 0;
}

/* diagram: the picture the editor saved from the diagram's source. */
.content-diagram {
  margin: 32px 0 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.content-diagram-scroll {
  overflow-x: auto;
}

/* A diagram shows at its drawn size, so a long one scrolls sideways instead of shrinking its labels out of reach. */
.content-diagram img {
  max-width: none;
  height: auto;
  vertical-align: top;
}

@media (max-width: 640px) {
  .content-gallery.g-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-columns.c-2,
  .content-columns.c-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .content-diagram {
    padding: 16px;
  }

  /* Shrunk to a phone's width, a diagram's labels would be a few pixels high: it keeps most of its drawn size and scrolls sideways. */
  .content-diagram img {
    max-width: none;
  }
}

/* labels: column names over a side-by-side picture, one per half. */
.column-labels {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  margin: 28px 0 -12px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.column-labels + figure {
  margin-top: 20px;
}

/* cta: a dark button with an arrow, the way to the next page. */
.content-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 40px !important;
}

:is(.post-body, .showcase-body) a.content-cta {
  gap: 10px;
  color: var(--accent);
  text-decoration: none;
}

:is(.post-body, .showcase-body) a.content-cta:hover {
  color: var(--accent);
}

/* One class per percent, since the CSP refuses style attributes; kept compact on purpose. */
/* prettier-ignore */
@media all {
  .p-0 { --p: 0%; } .p-1 { --p: 1%; } .p-2 { --p: 2%; } .p-3 { --p: 3%; } .p-4 { --p: 4%; } .p-5 { --p: 5%; } .p-6 { --p: 6%; }
  .p-7 { --p: 7%; } .p-8 { --p: 8%; } .p-9 { --p: 9%; } .p-10 { --p: 10%; } .p-11 { --p: 11%; } .p-12 { --p: 12%; } .p-13 { --p: 13%; }
  .p-14 { --p: 14%; } .p-15 { --p: 15%; } .p-16 { --p: 16%; } .p-17 { --p: 17%; } .p-18 { --p: 18%; } .p-19 { --p: 19%; } .p-20 { --p: 20%; }
  .p-21 { --p: 21%; } .p-22 { --p: 22%; } .p-23 { --p: 23%; } .p-24 { --p: 24%; } .p-25 { --p: 25%; } .p-26 { --p: 26%; } .p-27 { --p: 27%; }
  .p-28 { --p: 28%; } .p-29 { --p: 29%; } .p-30 { --p: 30%; } .p-31 { --p: 31%; } .p-32 { --p: 32%; } .p-33 { --p: 33%; } .p-34 { --p: 34%; }
  .p-35 { --p: 35%; } .p-36 { --p: 36%; } .p-37 { --p: 37%; } .p-38 { --p: 38%; } .p-39 { --p: 39%; } .p-40 { --p: 40%; } .p-41 { --p: 41%; }
  .p-42 { --p: 42%; } .p-43 { --p: 43%; } .p-44 { --p: 44%; } .p-45 { --p: 45%; } .p-46 { --p: 46%; } .p-47 { --p: 47%; } .p-48 { --p: 48%; }
  .p-49 { --p: 49%; } .p-50 { --p: 50%; } .p-51 { --p: 51%; } .p-52 { --p: 52%; } .p-53 { --p: 53%; } .p-54 { --p: 54%; } .p-55 { --p: 55%; }
  .p-56 { --p: 56%; } .p-57 { --p: 57%; } .p-58 { --p: 58%; } .p-59 { --p: 59%; } .p-60 { --p: 60%; } .p-61 { --p: 61%; } .p-62 { --p: 62%; }
  .p-63 { --p: 63%; } .p-64 { --p: 64%; } .p-65 { --p: 65%; } .p-66 { --p: 66%; } .p-67 { --p: 67%; } .p-68 { --p: 68%; } .p-69 { --p: 69%; }
  .p-70 { --p: 70%; } .p-71 { --p: 71%; } .p-72 { --p: 72%; } .p-73 { --p: 73%; } .p-74 { --p: 74%; } .p-75 { --p: 75%; } .p-76 { --p: 76%; }
  .p-77 { --p: 77%; } .p-78 { --p: 78%; } .p-79 { --p: 79%; } .p-80 { --p: 80%; } .p-81 { --p: 81%; } .p-82 { --p: 82%; } .p-83 { --p: 83%; }
  .p-84 { --p: 84%; } .p-85 { --p: 85%; } .p-86 { --p: 86%; } .p-87 { --p: 87%; } .p-88 { --p: 88%; } .p-89 { --p: 89%; } .p-90 { --p: 90%; }
  .p-91 { --p: 91%; } .p-92 { --p: 92%; } .p-93 { --p: 93%; } .p-94 { --p: 94%; } .p-95 { --p: 95%; } .p-96 { --p: 96%; } .p-97 { --p: 97%; }
  .p-98 { --p: 98%; } .p-99 { --p: 99%; } .p-100 { --p: 100%; }
}

:is(.post-body, .showcase-body) .align-center {
  text-align: center;
}

:is(.post-body, .showcase-body) .align-right {
  text-align: right;
}

.author-card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-top: 64px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.author-avatar {
  flex: none;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent);
  color: var(--ink);
  font-size: 22px;
  font-weight: 700;
}

.author-card .name {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.author-card .role {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.author-card p {
  margin: 12px 0 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-2);
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 40px;
}

.post-nav a {
  display: block;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease;
}

.post-nav a:hover {
  border-color: var(--ink);
  background: var(--bg);
}

.post-nav .next {
  grid-column: 2;
  text-align: right;
}

.post-nav strong {
  display: block;
  margin-top: 6px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

/* Showcases */

.showcases-hero {
  padding-block: var(--section-pad-sm);
}

.showcases-hero h1 {
  margin: 16px 0 0;
  font-size: clamp(36px, 4.4vw, 60px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.showcase > h2 {
  margin: 0;
  max-width: 820px;
}

.showcase-intro {
  max-width: 820px;
  margin-top: 24px;
}

.showcase-summary {
  margin: 0;
  font-size: 20px;
  line-height: 1.6;
  color: var(--ink-body);
}

.showcase-intro .showcase-body {
  margin-top: 24px;
  font-size: 20px;
  line-height: 1.6;
}

.showcase-video {
  max-width: 960px;
  margin: 48px 0 0;
}

.video-frame {
  position: relative;
}

.video-play {
  position: absolute;
  top: calc(50% - 32px);
  left: calc(50% - 32px);
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  padding: 0 0 0 4px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition:
    transform 0.15s ease,
    background-color 0.15s ease;
}

.video-play:hover {
  background: var(--accent-hover);
  transform: scale(1.06);
}

.showcase-video video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  background: var(--dark);
}

.showcase-video figcaption p {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.showcase-video figcaption em {
  font-style: normal;
}

.showcase-rest {
  max-width: 960px;
  margin-top: 56px;
  font-size: 18px;
  line-height: 1.6;
}

/* A chart followed by a table sits beside it, as the benchmark's results do. */
.showcase-rest {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  column-gap: 32px;
  align-items: start;
}

.showcase-rest > * {
  grid-column: 1 / -1;
}

.showcase-rest > :is(p, ul, ol, h3, h4) {
  max-width: 820px;
}

.showcase-rest > .chart:has(+ .table-wrap),
.showcase-rest > .chart + .table-wrap {
  grid-column: auto;
  margin-top: 40px;
}

.showcase-rest > .callout {
  margin-top: 48px;
}

.showcase-body h3:first-child {
  margin-top: 0;
}

@media (max-width: 960px) {
  .post-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    position: static;
    order: 0;
  }

  .toc.folded {
    margin-top: -40px;
  }

  .toc.folded:not(.open) {
    display: none;
  }

  .toc.folded > .eyebrow {
    display: none;
  }

  .toc.folded ol {
    margin-top: 0;
  }
}

@media (max-width: 720px) {
  .blog-hero {
    padding-block: 64px 40px;
  }

  .post-grid {
    grid-template-columns: minmax(0, 1fr);
    padding: 40px 0 80px;
    gap: 28px;
  }

  .post-header {
    padding-block: 48px 32px;
  }

  .post-cover {
    margin-bottom: 40px;
  }

  .post-layout {
    padding-block: 40px 72px;
    gap: 32px;
  }

  .post-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-nav .next {
    grid-column: 1;
  }

  .author-card {
    flex-direction: column;
    padding: 22px;
  }

  .showcase-video,
  .showcase-rest {
    margin-top: 28px;
  }

  .showcase-intro .showcase-body,
  .showcase-summary {
    font-size: 18px;
  }

  :is(.post-body, .showcase-body) blockquote.callout {
    padding: 20px;
  }

  .callout .stat-value {
    font-size: 36px;
  }

  .chart {
    padding: 20px 16px;
  }

  .chart-axis,
  .chart-bars {
    height: 200px;
  }

  /* Labels under narrow columns wrap to three or four lines, and they hang below the plot rather than in its flow. */
  .chart-plot {
    padding-left: 40px;
    margin-bottom: 96px;
  }

  .chart.line .chart-plot {
    margin-bottom: 8px;
  }

  .chart-axis {
    width: 34px;
  }
}

@media (max-width: 900px) {
  .showcase-rest {
    grid-template-columns: minmax(0, 1fr);
  }

  .showcase-rest > .chart:has(+ .table-wrap),
  .showcase-rest > .chart + .table-wrap {
    grid-column: 1 / -1;
  }

  .showcase-rest > .chart + .table-wrap {
    margin-top: 24px;
  }

  .showcase-body blockquote.feature {
    grid-template-columns: minmax(0, 1fr);
  }

  .showcase-body blockquote.feature > .chart {
    grid-column: 1;
    grid-row: auto;
    margin-top: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .tag,
  .post-nav a,
  .post-card h2 a {
    transition: none;
  }
}

/* The page's own padding for code would put the first line under the Copy button. */
:is(.post-body, .showcase-body) .code-box > pre {
  padding-right: 80px;
}

/* A phone shows only the start of a long line, which the Copy button would cover, so the code starts below the button there. */
@media (max-width: 600px) {
  :is(.post-body, .showcase-body) .code-box > pre {
    padding-top: 52px;
    padding-right: 20px;
  }

  :is(.post-body, .showcase-body) .code-copy {
    height: 36px;
    padding: 0 14px;
  }
}

/* The slider's frame clips an outline, so keyboard focus rings the handle and the whole figure. */
.content-compare.is-live:has(.compare-range:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: var(--radius);
}

.content-compare.is-live:has(.compare-range:focus-visible) .compare-stage::before {
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--accent);
}

.showcase-video video:focus-visible,
:is(.post-body, .showcase-body) .content-video video:focus-visible,
:is(.code-box > pre, .content-diagram-scroll, .table-wrap):focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* On a phone the bar labels share narrow columns: smaller, and allowed to wrap rather than run into each other. */
@media (max-width: 600px) {
  .chart-label {
    right: 0;
    left: 0;
    font-size: 12px;
    overflow-wrap: anywhere;
  }
}
