/* Immutable Slate publication presentation. Use a new filename for revisions. */
body > .publisher-bar:has(> .publisher-link[href="https://slate-app.online/"]) {
  position: fixed;
  z-index: 40;
  pointer-events: none;
}

body > .publisher-bar > .publisher-link[href="https://slate-app.online/"] {
  box-sizing: border-box;
  min-height: 2.75rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line, var(--border, #d5dcd7));
  border-radius: 0.65rem;
  background: var(--surface, var(--bg, #fff));
  color: var(--text, var(--text-primary, #1a1f1c));
  box-shadow: 0 2px 12px rgb(0 0 0 / 12%);
  opacity: 1;
  pointer-events: auto;
}

/* Heading links must land below the persistent attribution, including mobile. */
body:has(> .publisher-bar > .publisher-link[href="https://slate-app.online/"])
  .post-content :is(h2, h3)[id] {
  scroll-margin-top: 5.5rem;
}

.post-content {
  min-width: 0;
  --slate-table-line: var(--line, var(--border, #d5dcd7));
  --slate-table-surface: var(--surface, var(--bg-surface, #f7f9f8));
  --slate-table-text: var(--text, var(--text-primary, #1a1f1c));
}

.post-content .slate-publication-table {
  max-width: 100%;
  margin: 1.75rem 0 2rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border: 1px solid var(--slate-table-line);
  border-radius: 0.5rem;
  background: var(--slate-table-surface);
}

.post-content .slate-publication-table:focus-visible {
  outline: 2px solid var(--accent, #32c878);
  outline-offset: 3px;
}

/* These base styles also improve tables when JavaScript is unavailable. */
.post-content table {
  width: 100%;
  margin: 1.75rem 0 2rem;
  border: 1px solid var(--slate-table-line);
  border-collapse: collapse;
  background: var(--slate-table-surface);
  color: var(--slate-table-text);
  font-size: 0.9em;
  line-height: 1.5;
  letter-spacing: normal;
}

.post-content .slate-publication-table table {
  margin: 0;
  border: 0;
}

.post-content table :is(th, td) {
  min-width: 6.5rem;
  padding: 0.8rem 1rem;
  text-align: start;
  vertical-align: top;
}

.post-content table :is(th, td):first-child {
  min-width: 9rem;
}

.post-content table thead th {
  background: color-mix(in srgb, var(--slate-table-text) 7%, var(--slate-table-surface));
  border-bottom: 1px solid var(--slate-table-line);
  font-size: 0.9em;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: bottom;
}

.post-content table tbody tr + tr > *,
.post-content table tfoot tr > * {
  border-top: 1px solid var(--slate-table-line);
}

.post-content table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--slate-table-text) 2%, transparent);
}

.post-content table :is(.slate-numeric-cell, [align="right"]) {
  min-width: 3.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
}

.post-content table td:is(.slate-numeric-cell, [align="right"]) {
  white-space: nowrap;
}

.post-content table [align="center"] {
  text-align: center;
}

.post-content table [align="left"] {
  text-align: left;
}

@media print {
  body > .publisher-bar:has(> .publisher-link[href="https://slate-app.online/"]) {
    position: absolute;
  }

  .post-content .slate-publication-table {
    overflow: visible;
  }

  .post-content table :is(th, td),
  .post-content table :is(th, td):first-child,
  .post-content table :is(th, td):is(.slate-numeric-cell, [align="right"]) {
    min-width: 0;
    padding: 0.5rem;
    white-space: normal;
  }
}
