/* The inner pages of the site: the head of a page, the prose, the tables, the callouts, the cards, the lanes of the roadmap
   and the releases. Loaded after app.css, which holds the tokens: nothing here sets a colour of its own, so light and dark
   follow the page. */

/* The links to the pages: the current page is marked like the current section of the home page */

.site-nav-links a[aria-current="page"] {
  color: var(--color-accent-ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

/* The menu of a small screen: the links of the header are hidden under 860px, and the menu takes their place */

.nav-menu {
  display: none;
  position: relative;
}

.nav-menu summary {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -6px -10px;
  list-style: none;
  cursor: pointer;
  color: var(--color-text);
}

.nav-menu summary::-webkit-details-marker {
  display: none;
}

.nav-menu[open] summary {
  color: var(--color-accent-ink);
}

.nav-menu-list {
  position: absolute;
  top: calc(100% + 18px);
  right: calc(-1 * var(--gutter));
  z-index: 60;
  display: grid;
  gap: 2px;
  min-width: 220px;
  margin: 0;
  padding: 10px;
  list-style: none;
  border: 2px solid var(--color-divider);
  background: var(--color-bg);
}

.nav-menu-list a {
  display: block;
  padding: 12px 14px;
  font-size: 0.75rem;
  color: var(--color-text);
  text-decoration: none;
}

.nav-menu-list a:hover,
.nav-menu-list a[aria-current="page"] {
  background: var(--color-surface);
  color: var(--color-accent-ink);
}

@media (max-width: 860px) {
  .nav-menu {
    display: block;
  }

  .site-nav-inner .btn-small {
    display: none;
  }
}

/* The head of a page */

.page-head {
  position: relative;
  border-bottom: 2px solid var(--color-divider);
  overflow: clip;
}

.page-head-inner {
  position: relative;
  padding-block: clamp(40px, 6vw, 72px) clamp(48px, 7vw, 84px);
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
  letter-spacing: 0.08em;
  color: var(--color-quiet);
}

.crumbs a {
  color: var(--color-accent-ink);
  text-decoration: none;
}

.crumbs a:hover {
  text-decoration: underline;
}

.page-head h1 {
  max-width: 18em;
  font-size: clamp(2.125rem, 4.4vw, 3.5rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.page-lead {
  max-width: 40em;
  margin-top: 24px;
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
  color: color-mix(in srgb, var(--color-text) 82%, transparent);
  text-wrap: pretty;
}

.page-meta {
  margin-top: 28px;
  letter-spacing: 0.06em;
  color: var(--color-quiet);
}

/* The body of a page: a table of contents on the left, the prose on the right */

.doc {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: 24px clamp(32px, 5vw, 80px);
  padding-block: clamp(48px, 6vw, 80px) clamp(64px, 8vw, 112px);
}

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

.toc {
  align-self: start;
  position: sticky;
  top: 96px;
}

.toc .mono {
  margin: 0 0 14px;
  letter-spacing: 0.08em;
  color: var(--color-quiet);
}

.toc ol {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 2px solid var(--color-divider);
}

.toc a {
  display: block;
  padding: 7px 0 7px 16px;
  margin-left: -2px;
  border-left: 2px solid transparent;
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--color-muted);
  text-decoration: none;
}

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

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

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

  .toc {
    position: static;
  }

  .toc ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0 22px;
    border-left: 0;
    border-bottom: 2px solid var(--color-divider);
  }

  .toc a {
    padding: 8px 0;
    margin: 0 0 -2px;
    border-left: 0;
    border-bottom: 2px solid transparent;
  }

  .toc a[aria-current="location"] {
    border-bottom-color: var(--color-accent);
  }
}

/* The prose */

.prose {
  min-width: 0;
}

.doc-section {
  /* The header is already cleared by the scroll padding of the page. */
  scroll-margin-top: 8px;
}

/* The text of a section keeps the measure of the public prose; its drawings and tables take the whole column. */
.doc .prose > .doc-section {
  max-width: none;
}

.doc .prose > .doc-section > :where(:not(.diagram, .table-wrap)) {
  max-width: 760px;
}

.doc-section + .doc-section {
  margin-top: clamp(48px, 6vw, 72px);
  padding-top: clamp(40px, 5vw, 56px);
  border-top: 2px solid var(--color-divider);
}

.prose h2 {
  margin: 0 0 20px;
  font-size: clamp(1.625rem, 2.8vw, 2.25rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.prose h3 {
  margin: 36px 0 12px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.2;
}

.prose > p,
.prose .doc-section > p,
.prose .doc-section > ul,
.prose .doc-section > ol {
  max-width: 72ch;
}

.prose p {
  margin: 0 0 16px;
  text-wrap: pretty;
}

.prose p.lead {
  font-size: 1.125rem;
  color: color-mix(in srgb, var(--color-text) 86%, transparent);
}

.prose ul,
.prose ol {
  margin: 0 0 18px;
  padding-left: 22px;
}

.prose li {
  margin-bottom: 8px;
  padding-left: 4px;
}

.prose li::marker {
  color: var(--color-accent);
}

.prose a {
  color: var(--color-accent-ink);
  text-underline-offset: 3px;
}

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

.table code {
  overflow-wrap: normal;
  white-space: nowrap;
}

.prose code {
  padding: 1px 6px;
  background: var(--color-surface);
  font-family: var(--font-mono);
  font-size: 0.82em;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.prose pre {
  margin: 0 0 20px;
  padding: 18px 20px;
  overflow-x: auto;
  background: var(--color-field);
  border: 2px solid var(--color-divider);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
}

.prose pre code {
  padding: 0;
  background: none;
  font-size: inherit;
  overflow-wrap: normal;
}

.prose strong {
  font-weight: 600;
}

/* Tables: a header of small capitals, a rule under each row */

.table-wrap {
  margin: 4px 0 24px;
  overflow-x: auto;
  border-top: 2px solid var(--color-divider);
  border-bottom: 2px solid var(--color-divider);
}

.table-wrap:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.table caption {
  padding: 14px 0 6px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-quiet);
}

.table th,
.table td {
  padding: 12px 18px 12px 0;
  vertical-align: top;
  text-align: left;
}

.table th:last-child,
.table td:last-child {
  padding-right: 0;
}

.table thead th {
  padding-block: 14px 10px;
  border-bottom: 2px solid var(--color-divider);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-quiet);
  white-space: nowrap;
}

.table tbody tr + tr > * {
  border-top: 1px solid color-mix(in srgb, var(--color-text) 20%, transparent);
}

.table tbody th {
  font-weight: 600;
}

.table .num {
  font-variant-numeric: tabular-nums;
}

.table-note {
  margin: -8px 0 24px;
  font-size: 0.875rem;
  color: var(--color-quiet);
}

/* Chips: a state, in a word */

.chip {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid currentColor;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
}

.chip-ok {
  border-color: var(--color-text);
  background: var(--signal);
  color: #0c1016;
}

.chip-next {
  color: var(--color-accent-ink);
}

.chip-explore {
  border-style: dashed;
  color: var(--color-muted);
}

.chip-plain {
  color: var(--color-muted);
}

/* A callout: what the reader must not miss */

.callout {
  margin: 8px 0 24px;
  padding: 20px 24px 8px;
  border-left: 4px solid var(--color-accent);
  background: var(--color-surface);
}

.callout-title {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-ink);
}

.callout p:last-child {
  margin-bottom: 14px;
}

.callout-warn {
  border-left-color: var(--color-text);
}

.callout-warn .callout-title {
  color: var(--color-text);
}

/* Lists with a mark: a tick for what Beffroi does, a cross for what it does not */

.ticks,
.crosses {
  margin: 0 0 18px;
  padding-left: 0;
  list-style: none;
}

.ticks li,
.crosses li {
  position: relative;
  padding-left: 30px;
}

.ticks li::before,
.crosses li::before {
  content: '';
  position: absolute;
  top: 0.45em;
  left: 2px;
  width: 12px;
  height: 12px;
}

.ticks li::before {
  background: var(--color-accent);
  clip-path: polygon(0 55%, 15% 40%, 40% 62%, 85% 10%, 100% 25%, 40% 95%);
}

.crosses li::before {
  background: var(--color-text);
  clip-path: polygon(15% 0, 50% 35%, 85% 0, 100% 15%, 65% 50%, 100% 85%, 85% 100%, 50% 65%, 15% 100%, 0 85%, 35% 50%, 0 15%);
}

/* Cards: a short list of things to open */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin: 8px 0 24px;
  padding: 0;
  list-style: none;
}

.prose .doc-section > ul.cards {
  max-width: none;
  padding-left: 0;
}

.prose .cards > li {
  margin: 0;
  padding: 0;
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px;
  border: 2px solid var(--color-divider);
  background: var(--color-bg);
}

.card .mono {
  margin: 0 0 12px;
  letter-spacing: 0.08em;
  color: var(--color-accent-ink);
}

.card h3 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.card p {
  margin: 0 0 16px;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--color-muted);
}

.card .arrow-link {
  margin-top: auto;
}

/* The security defaults: each one named, with what the code does, marked by the brand square */

.defaults {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 4px 0 28px;
  border-top: 2px solid var(--color-divider);
}

.defaults > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: 8px 32px;
  padding: 16px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 20%, transparent);
}

.defaults dt {
  position: relative;
  padding-left: 30px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.0625rem;
  line-height: 1.3;
  text-wrap: balance;
}

.defaults dt::before {
  content: '';
  position: absolute;
  top: 0.45em;
  left: 2px;
  width: 10px;
  height: 10px;
  background: var(--color-accent);
}

.defaults dd {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--color-muted);
}

@media (max-width: 640px) {
  .defaults > div {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Facts: a term, and what is true of it */

.facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 4px 0 24px;
  border-top: 2px solid var(--color-divider);
}

.facts > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr);
  gap: 8px 32px;
  padding: 14px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 20%, transparent);
}

.facts dt {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-quiet);
}

.facts dd {
  margin: 0;
}

@media (max-width: 640px) {
  .facts > div {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The lanes of the roadmap: available, next, being explored */

.lanes {
  display: grid;
  align-items: start;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 8px 0 24px;
}

.lane {
  padding: 22px 22px 8px;
  border: 2px solid var(--color-divider);
  background: var(--color-bg);
}

.lane h3 {
  margin: 0 0 6px;
  font-size: 1.375rem;
}

.lane-note {
  margin: 0 0 18px;
  font-size: 0.875rem;
  color: var(--color-quiet);
}

.lane ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.lane li {
  padding: 14px 0;
  border-top: 1px solid color-mix(in srgb, var(--color-text) 20%, transparent);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.lane li strong {
  display: block;
  margin-bottom: 2px;
}

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

/* The releases of the changelog */

.releases {
  display: grid;
  gap: 0;
}

.release {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 8fr);
  gap: 16px clamp(24px, 4vw, 56px);
  padding-block: 32px;
}

.release + .release {
  border-top: 2px solid var(--color-divider);
}

.release-id {
  align-self: start;
}

.release-id h2 {
  margin: 0 0 10px;
  font-size: 1.875rem;
}

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

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

/* The people */

.people {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 8px 0 24px;
}

.person {
  padding: 24px;
  border: 2px solid var(--color-divider);
  background: var(--color-bg);
}

.person h3 {
  margin: 0 0 4px;
  font-size: 1.375rem;
}

.person .mono {
  margin: 0 0 14px;
  letter-spacing: 0.08em;
  color: var(--color-accent-ink);
}

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

/* What a creator is known for, the libraries of one and the talks of the other: a title that leads to it, and a line
   under it (what the library does, the event of the talk). The same list in both cards keeps them level. */
.person .person-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  line-height: 1.5;
}

.person .person-list li {
  padding: 8px 0;
  border-top: 1px solid color-mix(in srgb, var(--color-text) 20%, transparent);
}

.person .person-list .mono {
  display: block;
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--color-quiet);
}

/* A diagram: a drawing rendered from Mermaid by Pele, by the rules of the brand (charter p. 28 and 31, and the Pele
   theme of the Slidev theme): 2 px lines with square ends, boxes with square corners, labels in Martian Mono, ink for
   everything, the light for the path that matters, and corner brackets of 22 px around the figure rather than a frame
   that would weigh as much as a box. Pele reads its colours and its font from these variables, so that light and dark
   follow the page. The caption stands under it. A narrow screen gets a drawing of its own. */

.diagram {
  --bracket: linear-gradient(var(--color-accent), var(--color-accent));
  margin: 8px 0 32px;
  padding: clamp(20px, 3vw, 28px);
  background:
    var(--bracket) top left / 22px 2px no-repeat,
    var(--bracket) top left / 2px 22px no-repeat,
    var(--bracket) top right / 22px 2px no-repeat,
    var(--bracket) top right / 2px 22px no-repeat,
    var(--bracket) bottom left / 22px 2px no-repeat,
    var(--bracket) bottom left / 2px 22px no-repeat,
    var(--bracket) bottom right / 22px 2px no-repeat,
    var(--bracket) bottom right / 2px 22px no-repeat,
    var(--color-bg);
  /* The light of the tower: ultramarine on paper, the cold light on ink. */
  --diagram-light: var(--color-accent);
  --pele-bg: var(--color-bg);
  --pele-fg: var(--color-text);
  --pele-fg-on-light: #0c1016;
  --pele-fg-on-dark: #f2f4f6;
  --pele-muted: var(--color-muted);
  --pele-line: var(--color-text);
  --pele-surface: var(--color-field);
  --pele-surface-alt: var(--color-surface);
  --pele-border: var(--color-text);
  --pele-accent: var(--diagram-light);
  --pele-error: var(--color-error);
  --pele-critical: var(--color-error);
  --pele-font: var(--font-mono);
  --pele-font-mono: var(--font-mono);
  --pele-radius: 0;
  --pele-title-weight: 600;
  --pele-heading-weight: 600;
  --pele-bold-weight: 600;
  /* Charts and the branches of a mind map: ultramarine first, then the accent scale of the brand, ink last. */
  --pele-series-1: var(--diagram-light);
  --pele-series-2: #7d8bff;
  --pele-series-3: #1b2bb8;
  --pele-series-4: #a9b3ff;
  --pele-series-5: #2336e0;
  --pele-series-6: #cfd5ff;
  --pele-series-7: var(--color-text);
  --pele-series-8: var(--color-muted);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .diagram {
    --diagram-light: var(--color-accent-ink);
  }
}

:root[data-theme="dark"] .diagram {
  --diagram-light: var(--color-accent-ink);
}

.diagram svg {
  display: block;
  margin: 0 auto;
  font-stretch: 100%;
}

/* 2 px lines with square ends, 2 px borders, and no rounded corner anywhere. */
.diagram .pele-edge path:not(.pele-marker) {
  stroke-width: 2px;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.diagram .pele-node > rect,
.diagram .pele-node > polygon,
.diagram .pele-node > path,
.diagram .pele-node > circle,
.diagram .pele-node > ellipse {
  stroke-width: 2px;
}

.diagram rect {
  rx: 0 !important;
  ry: 0 !important;
}

/* A band (a subgraph) separates, it does not frame: the divider's weight of ink, at the width of a line. */
.diagram .pele-cluster > rect {
  stroke: var(--color-divider);
  stroke-width: 2px;
}

/* The lines of a label after its first: the description under the title. */
.diagram .pele-label .pele-sub {
  fill: var(--color-muted);
}

/* The path that matters: the node marked "light" in the source. */
.diagram .pele-node.light > rect,
.diagram .pele-node.light > polygon,
.diagram .pele-node.light > path,
.diagram .pele-node.light > circle {
  stroke: var(--diagram-light) !important;
}

.diagram .pele-node.light > .pele-label {
  fill: var(--color-accent-ink);
}

.diagram figcaption {
  margin-top: 20px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-quiet);
  text-wrap: pretty;
}

.diagram-fig {
  margin-right: 6px;
  color: var(--color-accent-ink);
}

.diagram-narrow {
  display: none;
}

@media (max-width: 640px) {
  .diagram-wide {
    display: none;
  }

  /* A drawing wider than the screen keeps its size and scrolls sideways, rather than shrinking past what can be read. */
  .diagram-narrow {
    display: block;
    overflow-x: auto;
  }

  .diagram-narrow svg {
    max-width: none !important;
  }
}

/* The references under a section: the specifications, the tools and the pages of the documentation it rests on */

.refs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
}

.refs li::after {
  content: '·';
  margin-left: 10px;
  color: var(--color-quiet);
}

.refs li:last-child::after {
  content: none;
}

.prose .doc-section > ul.refs {
  max-width: none;
  padding-left: 0;
}

.prose .refs li {
  margin: 0;
  padding: 0;
}

/* Text for a screen reader alone */

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

/* A table on a narrow screen: each row becomes a block, and each cell carries the name of its column (set by the script
   of the tables). Without the script, the table scrolls sideways inside its frame. */

@media (max-width: 640px) {
  .table.is-stacked {
    min-width: 0;
  }

  .table.is-stacked thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .table.is-stacked tr,
  .table.is-stacked tbody,
  .table.is-stacked tbody th,
  .table.is-stacked td {
    display: block;
  }

  .table.is-stacked tbody tr {
    padding: 14px 0;
  }

  .table.is-stacked tbody tr + tr {
    border-top: 1px solid color-mix(in srgb, var(--color-text) 20%, transparent);
  }

  .table.is-stacked tbody tr + tr > * {
    border-top: 0;
  }

  .table.is-stacked th,
  .table.is-stacked td {
    padding: 2px 0;
  }

  .table.is-stacked td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-quiet);
  }
}

/* The blog: the cards of the list, the tags, and the body of a post written in Markdown */

/* The head of the list: less air, the posts come first */

.page-head-compact .page-head-inner {
  padding-block: clamp(28px, 4vw, 48px) clamp(32px, 4.5vw, 56px);
}

.page-head-compact .crumbs {
  margin-bottom: 20px;
}

.page-head-compact .page-lead,
.page-head-compact .page-meta {
  margin-top: 16px;
}

.tag-list-label {
  margin: 0;
  letter-spacing: 0.08em;
  color: var(--color-quiet);
}

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

.page-head-compact .tag-list {
  margin-top: 24px;
}

.page-head-compact .tag-list ul {
  margin-top: 12px;
}

.tag-list li {
  margin: 0;
  padding: 0;
}

.tag-list a {
  text-decoration: none;
}

/* On a wide screen the topics stand at the right of the title, not under it: the head is shorter and the void is used */
@media (min-width: 900px) {
  .page-head-compact .page-head-inner {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    column-gap: clamp(32px, 5vw, 80px);
  }

  .page-head-compact .page-head-inner > :not(.tag-list) {
    grid-column: 1;
  }

  .page-head-compact .tag-list {
    grid-column: 2;
    grid-row: 1 / span 4;
    align-self: end;
    margin-top: 0;
  }
}

/* The posts: the latest as wide as the grid, then a grid that fills its rows. One column, two from 640 px, three from
   900 px (six tracks, a card on two). The cards of a last row that is not full take the width of the row: a card alone
   the width of the grid, two of them half each, so that the grid never ends on a void. */

.blog-list {
  padding-block: clamp(24px, 3.4vw, 40px) clamp(56px, 7vw, 96px);
}

.post-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(20px, 2.4vw, 32px);
}

/* A cell is the box a card is laid out in: a card that is wide shows its cover beside its text, whatever its place */
.post-cell {
  display: grid;
  container-type: inline-size;
}

@media (min-width: 640px) {
  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .post-grid > .post-cell-featured,
  .post-grid > .post-cell:last-child:nth-child(even) {
    grid-column: 1 / -1;
  }
}

@media (min-width: 900px) {
  .post-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .post-grid > .post-cell {
    grid-column: span 2;
  }

  .post-grid > .post-cell-featured,
  .post-grid > .post-cell:last-child:nth-child(3n + 2) {
    grid-column: 1 / -1;
  }

  .post-grid > .post-cell:last-child:nth-child(3n + 3),
  .post-grid > .post-cell:nth-last-child(2):nth-child(3n + 2) {
    grid-column: span 3;
  }

  /* From 900 px the even-numbered last cell of the two columns is a plain cell again */
  .post-grid > .post-cell:last-child:nth-child(even):not(:nth-child(3n + 2), :nth-child(3n + 3)) {
    grid-column: span 2;
  }
}

.post-card {
  position: relative;
  display: grid;
  padding: 2px;
  background: var(--color-text);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}

.post-card-inner {
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--color-surface);
  clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 15px, 100% 100%, 15px 100%, 0 calc(100% - 15px));
}

.post-card:hover,
.post-card:focus-within {
  background: var(--color-accent);
}

.post-card-media {
  position: relative;
  aspect-ratio: 1200 / 630;
  overflow: hidden;
  border-bottom: 2px solid var(--color-text);
  background: var(--color-bg);
}

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

/* A post without a cover: the grid of the site, and what the post is about */
.post-card-placeholder {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  height: 100%;
  padding: 16px;
  text-align: center;
  font-family: var(--font-heading);
  font-size: clamp(1.125rem, 1.8vw, 1.5rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text);
  background-image:
    linear-gradient(var(--color-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
}

/* The brand square over the topic */
.post-card-placeholder::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-text);
  background: var(--signal);
}

.post-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: clamp(16px, 2vw, 24px);
}

.post-meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--color-quiet);
}

.post-card h2 {
  margin: 0;
  font-size: clamp(1.25rem, 1.7vw, 1.5rem);
  line-height: 1.15;
  text-wrap: balance;
}

/* The title is the link of the whole card */
.post-card h2 a {
  color: inherit;
  text-decoration: none;
}

.post-card h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.post-card h2 a:focus-visible {
  outline: none;
}

/* The cut clips what is drawn outside the card: the ring of focus is drawn inside it. */
.post-card:has(h2 a:focus-visible) .post-card-inner {
  outline: 3px solid var(--color-text);
  outline-offset: -7px;
}

.post-card-excerpt {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  font-size: 0.9375rem;
  color: var(--color-muted);
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.post-card-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-ink);
}

.post-card:hover .post-card-more,
.post-card:focus-within .post-card-more {
  color: var(--color-accent-ink-hover);
}

/* A card in a cell at least 600 px wide: the cover beside the text, the text centred. The latest post is larger. */
@container (min-width: 600px) {
  .post-card:not(.post-card-compact) .post-card-inner {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    grid-template-rows: auto;
  }

  .post-card:not(.post-card-compact) .post-card-media {
    aspect-ratio: auto;
    min-height: 100%;
    border-right: 2px solid var(--color-text);
    border-bottom: 0;
  }

  .post-card:not(.post-card-compact) .post-card-media img {
    position: absolute;
    inset: 0;
  }

  .post-card:not(.post-card-compact) .post-card-body {
    justify-content: center;
    gap: 14px;
    padding: clamp(24px, 3.4vw, 48px);
  }

  .post-card-featured h2 {
    font-size: clamp(1.75rem, 2.8vw, 2.5rem);
  }

  .post-card-featured .post-card-excerpt {
    -webkit-line-clamp: 5;
    font-size: 1.0625rem;
  }
}

/* The preview of a post, for the admins: a flat strip over the page, a 2 px rule under it, with the way back to the form. */

.preview-banner {
  background: var(--color-surface);
  border-bottom: 2px solid var(--color-text);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

.preview-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 10px;
}

.preview-banner p {
  margin: 0;
}

.preview-banner a {
  color: var(--color-accent-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* A post: the head, the contents, the text, and what follows it. The text keeps a measure of 60 to 75 characters. */

.post-label {
  margin: 0 0 20px;
  letter-spacing: 0.08em;
  color: var(--color-quiet);
}

.post-head h1 {
  max-width: 22em;
}

/* The lead: Archivo 19 / 1.6 (the charter, p. 25) */
.post-lead {
  max-width: 40em;
  margin: 24px 0 0;
  font-size: 1.1875rem;
  line-height: 1.6;
  color: color-mix(in srgb, var(--color-text) 82%, transparent);
  text-wrap: pretty;
}

.post-head .tag-list ul {
  margin-top: 24px;
}

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

.post-main {
  min-width: 0;
}

/* The contents are at the left of the text from 1000 px; under that they are one closed list above it. */
.toc-aside {
  display: none;
}

.toc-details {
  margin: 0;
  border: 2px solid var(--color-text);
  background: var(--color-surface);
}

.toc-details summary {
  padding: 12px 16px;
  cursor: pointer;
  letter-spacing: 0.08em;
  color: var(--color-text);
}

.toc-details summary:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: -3px;
}

.toc-details ol {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 4px 16px 16px;
  list-style: none;
  font-size: 0.9375rem;
}

.toc-details a {
  display: block;
  padding: 6px 0;
}

.toc-sub {
  padding-left: 16px;
}

@media (min-width: 1000px) {
  .doc-article.has-toc {
    grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  }

  .toc-aside {
    display: block;
  }

  .toc-details {
    display: none;
  }

  .toc-aside .toc-sub {
    padding-left: 0;
  }

  .toc-aside .toc-sub a {
    padding-left: 28px;
  }
}

/* The blocks of the article are as wide as its column, up to 840 px; the text keeps a measure of its own */
.post-body.prose > * {
  max-width: 840px;
}

.post-body.prose > :where(p, ul, ol, h2, h3, blockquote) {
  max-width: 72ch;
}

.post-body h2 {
  margin-top: 48px;
}

/* A heading has an address: its link shows under the pointer, and when it has the focus */
.post-body :where(h2, h3) {
  scroll-margin-top: 16px;
}

.heading-anchor {
  margin-left: 0.4em;
  font-family: var(--font-mono);
  font-size: 0.75em;
  text-decoration: none;
  color: var(--color-quiet);
  opacity: 0;
}

.post-body :where(h2, h3):hover > .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
}

.heading-anchor:hover {
  color: var(--color-accent-ink);
}

@media (hover: none) {
  .heading-anchor {
    opacity: 0.6;
  }
}

/* Inline code: the background holds the letters and no more, so that no gap opens before a colon or a comma */
.post-body :where(p, li, td, th, blockquote) code {
  padding: 1px 0;
  box-decoration-break: clone;
}

/* Code: a label with its language and the copy button, then the code in a region the keyboard scrolls (Martian Mono 87.5 %, 14 / 1.7) */
.code-block {
  max-width: 840px;
  margin: 0 0 28px;
  border: 2px solid var(--color-text);
  background: var(--color-surface);
}

.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px 6px 14px;
  border-bottom: 2px solid var(--color-text);
}

.code-lang {
  letter-spacing: 0.08em;
  color: var(--color-quiet);
}

.code-bar .copy {
  position: static;
  min-width: 72px;
  height: 28px;
}

.code-scroll {
  position: relative;
}

.code-block pre {
  margin: 0;
  padding: 16px 20px;
  overflow-x: auto;
  border: 0;
  background: none;
  font-size: 0.875rem;
  font-stretch: 87.5%;
  line-height: 1.7;
  tab-size: 4;
  scroll-timeline: --code inline;
}

.code-block pre:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: -3px;
}

/* More code at the right: a bar on the edge, which goes when the end is reached. Where scroll-driven animations are not
   known, there is no bar, and the region scrolls all the same. */
@supports (animation-timeline: scroll()) {
  .code-scroll {
    timeline-scope: --code;
  }

  .code-scroll::after {
    content: "";
    position: absolute;
    inset: 0 0 0 auto;
    width: 6px;
    background: var(--color-accent);
    opacity: 0;
    pointer-events: none;
    animation: code-more linear both;
    animation-timeline: --code;
    animation-range: calc(100% - 40px) 100%;
  }

  @keyframes code-more {
    from {
      opacity: 1;
    }

    to {
      opacity: 0;
    }
  }
}

/* An image of the library: a figure in a frame of 2 px, never wider than the column */
.post-figure {
  max-width: 840px;
  margin: 32px 0;
}

.post-figure picture,
.post-body > p picture {
  display: block;
}

.post-figure img,
.post-body > p picture img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border: 2px solid var(--color-text);
}

.post-figure figcaption {
  margin-top: 8px;
  font-size: 0.875rem;
  color: var(--color-quiet);
}

/* A diagram of a post: the .diagram of the documentation (corner brackets, the colours and the font of the brand) holds a
   Pele drawing made in the page. The Mermaid source stays under it, closed, and stands alone when it is not drawn. */
.post-body .diagram {
  max-width: 840px;
  margin: 32px 0;
}

.diagram-text {
  margin-top: 20px;
  border-top: 2px solid var(--color-divider);
}

.diagram-text summary {
  padding: 10px 0 0;
  cursor: pointer;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.diagram-text summary:focus-visible,
.diagram-source:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.prose .diagram-source {
  margin: 12px 0 0;
  padding: 0;
  border: 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  background: transparent;
}

.prose .diagram-source code {
  font-size: inherit;
  background: none;
}

.diagram-error {
  margin: 12px 0 0;
  padding-left: 12px;
  border-left: 4px solid var(--color-accent);
  font-size: 0.75rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* The cover beside the title, from 1000 px; under it, above the text. A photograph: straight corners, a 2 px ink rule. */
.post-head-grid {
  display: grid;
  gap: 32px;
  align-items: center;
}

.post-head-text {
  min-width: 0;
}

.post-head-cover {
  margin: 0;
  border: 2px solid var(--color-text);
  background: var(--color-surface);
}

.post-head-cover img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
}

@media (min-width: 1000px) {
  .post-head-grid.has-cover {
    grid-template-columns: minmax(0, 1fr) minmax(0, 480px);
    gap: 56px;
  }

  .post-head-grid.has-cover h1 {
    font-size: clamp(2rem, 3.2vw, 2.75rem);
  }
}

/* What follows the text: who wrote it, what to read next, the way back, the list of releases */
.post-end {
  max-width: 840px;
  margin-top: clamp(48px, 6vw, 72px);
  padding-top: 32px;
  border-top: 2px solid var(--color-text);
}

.post-end-label {
  margin: 0 0 12px;
  letter-spacing: 0.08em;
  color: var(--color-quiet);
}

.post-author-name {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
}

.post-author-role {
  margin: 6px 0 0;
  letter-spacing: 0.06em;
  color: var(--color-muted);
}

.post-next {
  margin-top: 40px;
}

.post-next-grid {
  display: grid;
  gap: 16px;
}

/* From 1000 px two cards side by side in the text column; a single one keeps the width of one of them, at the left */
@media (min-width: 1000px) {
  .post-next-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* At the end of a post a card is small: a thin band for a cover, one line for the date, two for the excerpt */
.post-card-compact .post-card-inner {
  grid-template-rows: auto;
}

.post-card-compact .post-card-media {
  aspect-ratio: 1200 / 300;
}

.post-card-compact .post-card-body {
  gap: 8px;
  padding: 16px 20px 18px;
}

.post-card-compact .post-meta {
  white-space: nowrap;
}

.post-card-compact h2 {
  font-size: 1.125rem;
}

.post-card-compact .post-card-excerpt {
  -webkit-line-clamp: 2;
  font-size: 0.875rem;
}

.post-card-kicker {
  margin: 0;
  letter-spacing: 0.08em;
  color: var(--color-accent-ink);
}

.post-back {
  margin: 32px 0 0;
}

.post-notify {
  margin: 20px 0 0;
  font-size: 0.9375rem;
  color: var(--color-muted);
}
