/* Opt-in content foundations. Components own their spacing and borders. */
:root {
  --content-inset: var(--tr-space-stack-lg);
  --content-gap: var(--tr-space-stack-lg);
  --content-stack: var(--tr-space-stack-md);
  --content-section-gap: var(--tr-space-stack-2xl);
}

.content-section {
  --content-note-color: var(--tr-color-information-note);

  box-sizing: border-box;
  min-width: 0;
  margin-block: 0;
  padding: var(--content-inset);
  border: 1px solid var(--tr-color-line-rule);
  border-radius: var(--tr-radius-panel);
  background: var(--tr-color-surface-panel);
  box-shadow: none;
}

/* The following panel owns the boundary; the hero does not add a second rule. */
.public-hero:has(+ .content-section) {
  border-bottom: 0;
}

.content-section :is(p, li) {
  font-size: 16px;
  line-height: 1.6;
}

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

.content-section > :last-child {
  margin-bottom: 0;
}

.content-section :is(h2, h3) {
  color: var(--tr-color-text-primary);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.content-section > p {
  max-width: 78ch;
  color: var(--tr-color-text-secondary);
  line-height: 1.7;
}

.content-section h2 {
  margin: 0 0 var(--content-stack);
  font-size: 24px;
  font-weight: var(--tr-font-weight-semibold);
}

.content-prose {
  min-width: 0;
  max-width: 78ch;
  padding: 0;
  color: var(--tr-color-text-secondary);
}

.content-prose :is(p, li),
p.content-prose {
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.content-prose p {
  margin: 0 0 var(--content-stack);
}

.content-prose > :last-child {
  margin-bottom: 0;
}

.content-label {
  display: block;
  margin: 0 0 var(--tr-space-stack-sm);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--tr-color-text-tertiary);
  font-family: var(--tr-font-family-sans);
  font-size: 12px;
  font-weight: var(--tr-font-weight-medium);
  line-height: 1.5;
  text-transform: uppercase;
}

.content-label::before,
.content-label::after {
  content: none;
}

.content-examples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: var(--content-gap);
  min-width: 0;
  margin-block: var(--content-gap);
  padding: 0;
  border: 0;
}

.content-example {
  box-sizing: border-box;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.content-example h3 {
  margin: 0 0 var(--content-stack);
  font-size: 18px;
  font-weight: var(--tr-font-weight-semibold);
}

.content-example > :last-child {
  margin-bottom: 0;
}

.content-section pre {
  box-sizing: border-box;
  display: block;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: var(--tr-space-stack-sm);
  overflow-x: auto;
  border: 0;
  border-radius: var(--tr-radius-panel);
  background: var(--tr-color-surface-panel-inset);
  color: var(--tr-color-text-secondary);
  font-family: var(--tr-font-family-mono);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre;
  tab-size: 2;
}

.content-section pre.maple-api-example {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.content-section pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  white-space: inherit;
}

.content-section pre:focus-visible {
  outline: 2px solid var(--tr-color-focus);
  outline-offset: 4px;
}

.content-reference {
  min-width: 0;
  max-width: 100%;
  margin-block: var(--content-gap);
  overflow-x: auto;
  border: 0;
}

table.content-reference,
.content-reference table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.6;
}

.content-reference :is(th, td) {
  padding: var(--content-stack);
  border: 0;
  border-bottom: 1px solid var(--tr-color-line-rule-soft);
  vertical-align: top;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.content-reference :is(th, td):first-child {
  padding-left: 0;
}

.content-reference :is(th, td):last-child {
  padding-right: 0;
}

.content-reference th {
  background: transparent;
  color: var(--tr-color-text-tertiary);
  font-weight: var(--tr-font-weight-bold);
}

.content-reference .reference-key {
  color: var(--tr-color-text-primary);
  font-weight: var(--tr-font-weight-bold);
}

.reference-cell-label {
  display: none;
}

@media (max-width: 900px) {
  :root {
    --content-inset: var(--tr-space-gutter-600);
    --content-section-gap: var(--tr-space-stack-xl);
  }

  .content-section pre {
    padding: var(--tr-space-stack-xs);
  }

  .content-section h2 {
    font-size: 22px;
  }

  .content-reference {
    font-size: 16px;
  }

  .content-reference table {
    font-size: inherit;
  }

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

  .content-reference .reference-mobile-table,
  table.content-reference.reference-mobile-table,
  .reference-mobile-table :is(tbody, tr, th, td) {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

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

  .content-reference .reference-mobile-table tr,
  .content-reference.reference-mobile-table tr {
    padding-block: var(--content-gap);
    border-bottom: 1px solid var(--tr-color-line-rule);
  }

  .content-reference .reference-mobile-table :is(th, td),
  .content-reference.reference-mobile-table :is(th, td) {
    padding: 0 0 var(--content-stack);
    border: 0;
    background: transparent;
  }

  .content-reference .reference-mobile-table :is(th, td):last-child,
  .content-reference.reference-mobile-table :is(th, td):last-child {
    padding-bottom: 0;
  }

  .content-reference .reference-key,
  .content-reference .reference-key code {
    font-size: 16px;
    line-height: 1.5;
    font-weight: var(--tr-font-weight-bold);
  }

  .reference-mobile-table .reference-cell-label {
    display: block;
    margin: 0 0 var(--tr-space-stack-xs);
    color: var(--tr-color-text-tertiary);
    font-family: var(--tr-font-family-sans);
    font-size: 12px;
    font-weight: var(--tr-font-weight-medium);
    line-height: 1.4;
  }

  .reference-mobile-table .reference-key .reference-cell-label {
    display: none;
  }
}

@media (min-width: 901px) {
  .content-reference .reference-key,
  .content-reference .reference-key code {
    width: auto;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* Docs tables outside .content-reference keep their own desktop layout
   and stack into labelled rows on phones. */
@media (max-width: 900px) {
  :not(.content-reference) > table.reference-mobile-table {
    table-layout: auto;
  }

  :not(.content-reference) > .reference-mobile-table tr {
    padding-block: var(--content-gap);
    border-bottom: 1px solid var(--tr-color-line-rule);
  }

  :not(.content-reference) > .reference-mobile-table :is(th, td) {
    padding: 0 0 var(--content-stack);
    border: 0;
    background: transparent;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 16px;
    line-height: 1.6;
  }

  :not(.content-reference) > .reference-mobile-table :is(th, td):last-child {
    padding-bottom: 0;
  }

  /* The last card needs no rule; the gap separates it from what follows. */
  :not(.content-reference) > .reference-mobile-table tbody tr:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }

  :not(.content-reference) > table.reference-mobile-table + *,
  :is(.model-table-wrap, .leaderboard-table-wrap):has(> .reference-mobile-table) + * {
    margin-top: var(--content-gap);
  }

  :not(.content-reference) > .reference-mobile-table .reference-key,
  :not(.content-reference) > .reference-mobile-table .reference-key code {
    font-size: 16px;
    line-height: 1.5;
    font-weight: var(--tr-font-weight-bold);
    color: var(--tr-color-text-primary);
  }
}

@media (min-width: 901px) {
  /* Names in the first column never break mid-word; the column grows instead. */
  :not(.content-reference) > .reference-mobile-table .reference-key,
  :not(.content-reference) > .reference-mobile-table .reference-key code {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
  }
}

/* Comparison tables stay tables on phones: they scroll sideways with the
   first column pinned, arrow buttons above, and a fade on the right edge
   while more columns are hidden. */
.scroll-table :is(th, td):first-child {
  overflow-wrap: normal;
  word-break: normal;
}

.scroll-table + * {
  margin-top: var(--content-gap);
}

@media (max-width: 900px) {
  .scroll-table {
    --scroll-table-pin: 8rem;

    container-type: inline-size;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding-inline-start: var(--scroll-table-pin);
  }

  .scroll-table-controls {
    margin: 0 0 var(--tr-space-stack-xs);
  }

  /* The second column fills exactly what the pinned column leaves, so it is
     readable without swiping; the remaining columns follow off screen. */
  .scroll-table > table {
    width: calc(100cqw + var(--scroll-table-rest, 24rem));
    max-width: none;
    table-layout: fixed;
  }

  .scroll-table :is(th, td):nth-child(2) {
    width: calc(100cqw - var(--scroll-table-pin));
    padding-right: var(--tr-space-stack-md);
  }

  .scroll-table :is(th, td) {
    font-size: 15px;
    line-height: 1.5;
  }

  .scroll-table :is(th, td):first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    width: var(--scroll-table-pin);
    font-size: 12.5px;
    background: var(--panel);
    box-shadow: inset -1px 0 0 var(--tr-color-line-rule);
  }

  /* Swipes settle on a column edge beside the pinned column. */
  .scroll-table :is(th, td):not(:first-child) {
    scroll-snap-align: start;
  }

  .scroll-table th:first-child {
    background: var(--panel2);
  }
}

@media (min-width: 901px) {
  .scroll-table :is(th, td):first-child,
  .scroll-table :is(th, td):first-child * {
    white-space: nowrap;
  }

  .scroll-table wbr {
    display: none;
  }
}

/* Technical text stays proportional to the surrounding reading size. */
.content-section code {
  font-family: var(--tr-font-family-mono);
  font-size: 0.9em;
  line-height: inherit;
  overflow-wrap: anywhere;
}

.content-section pre code {
  font-size: inherit;
  overflow-wrap: normal;
}

.content-section h3 {
  font-size: 18px;
  font-weight: var(--tr-font-weight-semibold);
}

.content-group,
.content-note,
.content-details {
  max-width: 78ch;
  margin-block: var(--tr-space-stack-xl);
}

.content-section :is(.content-group, .content-note, .content-details) p {
  margin-block: var(--content-stack);
  color: var(--tr-color-text-secondary);
}

.content-section :is(.content-group, .content-note) h3 {
  margin: 0 0 var(--content-stack);
}

.content-note ul {
  padding-left: 1.25em;
  color: var(--tr-color-text-secondary);
}

.content-note li + li {
  margin-top: var(--tr-space-stack-xs);
}

.content-details dt {
  margin-top: var(--content-gap);
  color: var(--tr-color-text-primary);
}

.content-details dd {
  margin: var(--tr-space-stack-xs) 0 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--tr-color-text-secondary);
}

.content-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--tr-space-stack-xs) var(--content-gap);
}

.content-reference [data-reference-compact] {
  table-layout: fixed;
}

.content-reference [data-reference-compact] :is(th, td):first-child {
  width: 29%;
  white-space: normal;
}

.content-reference [data-reference-compact] :is(th, td):nth-child(2) {
  width: 39%;
}

.content-reference [data-reference-compact] .reference-key code {
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .content-reference [data-reference-compact].reference-mobile-table tr {
    padding-block: var(--content-stack);
  }

  .content-reference [data-reference-compact].reference-mobile-table :is(th, td) {
    width: 100%;
    padding-bottom: var(--tr-space-stack-xs);
  }

  .content-reference [data-reference-compact] .reference-cell-label {
    display: none;
  }

  .content-reference [data-reference-compact].reference-mobile-table td:last-child {
    color: var(--tr-color-text-secondary);
    padding: var(--tr-space-stack-xs);
    background: var(--tr-color-surface-panel-inset);
  }

  .content-reference [data-reference-compact] .reference-key code {
    font-size: 0.9em;
  }
}

.content-section .content-group + .content-group,
.content-section .content-note + .content-group {
  margin-top: var(--tr-space-stack-xl);
}

.content-section pre.content-code-wrap,
.content-section pre.content-code-wrap code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.content-section .content-value-code {
  display: block;
  white-space: pre-wrap;
}

/* Documentation uses quiet information styling; reserve alerts for live status. */
.content-section h2 {
  font-weight: var(--tr-font-weight-bold);
}

.content-section .content-details {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
  gap: var(--content-stack) var(--content-gap);
  margin-block: var(--content-gap);
}

.content-section .content-details dt,
.content-section .content-details dd {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
}

.content-section .content-details dt,
.content-reference .reference-key,
.content-reference .reference-key code {
  color: var(--tr-color-link-base);
  font-weight: var(--tr-font-weight-medium);
}

.content-section .content-note {
  margin-block: var(--content-gap);
}

.content-section .content-note h3 {
  color: var(--content-note-color);
  font-size: 16px;
}

.content-disclosure summary {
  display: flex;
  align-items: center;
  gap: var(--tr-space-stack-sm);
  min-height: 44px;
  color: var(--content-note-color);
  font-size: 16px;
  font-weight: var(--tr-font-weight-medium);
  line-height: 1.5;
  cursor: pointer;
  list-style: none;
}

.content-disclosure summary::-webkit-details-marker {
  display: none;
}

.content-disclosure summary::after {
  content: "";
  flex: 0 0 8px;
  height: 8px;
  margin-left: auto;
  margin-right: 4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.content-disclosure[open] summary::after {
  transform: rotate(225deg);
}

.content-note-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
}

.content-disclosure-body {
  padding-top: var(--tr-space-stack-xs);
}

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

.content-disclosure-body > :last-child {
  margin-bottom: 0;
}

.content-disclosure summary:focus-visible {
  outline: 2px solid var(--tr-color-focus);
  outline-offset: 3px;
}

@media (max-width: 700px) {
  .content-section .content-details {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--tr-space-stack-xs);
  }

  .content-section .content-details dd + dt {
    margin-top: var(--tr-space-stack-sm);
  }
}

.content-section a {
  color: var(--tr-color-link-dot);
  text-decoration: underline;
  text-decoration-color: var(--tr-color-link-underline);
  text-underline-offset: 0.2em;
}

.content-section a:hover {
  color: var(--tr-color-link-base);
}

.content-note-icon,
.content-disclosure summary::after {
  color: var(--content-note-color);
}

/* Opt-in reading shell: full-width content until a rail fits comfortably. */
.content-document {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.content-reader {
  display: grid;
  gap: var(--content-stack);
  min-width: 0;
}

.content-reader :is(.content-section, h2) {
  scroll-margin-top: 24px;
}

.content-reader .content-group,
.content-reader .content-note {
  margin-block: var(--content-stack);
}

.content-reader .content-reference .reference-mobile-table tr {
  padding-block: var(--tr-space-stack-sm);
}

.public-hero:has(+ .content-reader) {
  border-bottom: 0;
}

.content-toc {
  display: none;
  position: sticky;
  top: 0;
  align-self: start;
  z-index: 5;
  min-width: 0;
  border: 1px solid var(--tr-color-line-rule);
  border-radius: var(--tr-radius-panel);
  background: var(--tr-color-surface-panel);
}

.content-toc-title {
  display: none;
}

.content-toc summary {
  display: flex;
  align-items: center;
  gap: var(--tr-space-stack-sm);
  min-height: 48px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  color: var(--tr-color-text-primary);
}

.content-toc summary::-webkit-details-marker {
  display: none;
}

.content-toc summary::after {
  content: "";
  flex: 0 0 7px;
  height: 7px;
  margin-left: auto;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
}

.content-toc details[open] summary::after {
  transform: rotate(225deg);
}

.content-toc-current {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--tr-color-text-tertiary);
  font-size: 12px;
  min-width: 0;
  flex: 1;
}

.content-toc ol {
  list-style: none;
  margin: 0;
  padding: 8px;
  max-height: min(60svh, 560px);
  overflow-y: auto;
}

.content-toc a {
  display: block;
  padding: 10px 12px;
  min-height: 44px;
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1.5;
  text-decoration: none;
  color: var(--tr-color-text-secondary);
  border-left: 2px solid transparent;
}

.content-toc a[aria-current="location"] {
  color: var(--tr-color-accent-base);
  border-left-color: var(--tr-color-accent-base);
  background: var(--tr-color-surface-selected);
}

.content-toc a:hover {
  background: var(--tr-color-surface-hover);
}

.content-toc :is(a, summary):focus-visible {
  outline: 2px solid var(--tr-color-focus);
  outline-offset: -2px;
}

@media (min-width: 1400px) {
  .public-wrap:has([data-content-toc]) {
    width: min(100%, 1440px);
  }

  .content-reader:has(.content-toc) {
    grid-template-columns: minmax(0, 1fr) 208px;
    gap: var(--content-gap);
  }

  .content-document {
    grid-column: 1;
    grid-row: 1;
  }

  .content-toc {
    display: block;
    grid-column: 2;
    grid-row: 1;
    top: calc(var(--sticky-header-height, 0px) + 24px);
    border: 0;
    background: transparent;
  }

  .content-toc-title {
    display: block;
    margin: 0 0 8px;
    padding-inline: 12px;
    color: var(--tr-color-text-primary);
    font-size: 14px;
    font-weight: var(--tr-font-weight-semibold);
  }

  .content-toc summary {
    display: none;
  }

  .content-toc details > ol {
    display: block;
    max-height: calc(100svh - 80px - var(--sticky-header-height, 0px));
    padding: 0;
  }

  .content-reader :is(.content-section, h2) {
    scroll-margin-top: 24px;
  }
}

.content-toc summary > svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  color: var(--tr-color-accent-base);
}

.content-toc-long,
.content-reference-accordion {
  display: none;
}

.content-reference-entry {
  border-bottom: 1px solid var(--tr-color-line-rule-soft);
}

.content-reference-entry summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 12px;
  gap: 4px 12px;
  padding-block: 14px;
  min-height: 44px;
  list-style: none;
  cursor: pointer;
}

.content-reference-entry summary::-webkit-details-marker {
  display: none;
}

.content-reference-entry summary code {
  color: var(--tr-color-link-base);
  font-size: 14.4px;
  font-weight: var(--tr-font-weight-medium);
}

.content-reference-purpose {
  grid-column: 1;
  color: var(--tr-color-text-secondary);
  font-size: 16px;
  line-height: 1.5;
}

.content-reference-entry summary::after {
  content: "";
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  width: 7px;
  height: 7px;
  border-right: 1px solid var(--tr-color-text-tertiary);
  border-bottom: 1px solid var(--tr-color-text-tertiary);
  transform: rotate(45deg);
}

.content-reference-entry[open] summary::after {
  transform: rotate(225deg);
}

.content-reference-body {
  padding-bottom: var(--content-stack);
  font-size: 16px;
  line-height: 1.6;
  color: var(--tr-color-text-secondary);
}

.content-reference-values {
  margin-top: var(--tr-space-stack-sm);
  padding: var(--tr-space-stack-xs);
  background: var(--tr-color-surface-panel-inset);
}

.content-reference-values > strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: var(--tr-font-weight-medium);
  color: var(--tr-color-text-tertiary);
}

.content-reference-entry summary:focus-visible {
  outline: 2px solid var(--tr-color-focus);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .content-reference table.has-reference-accordion {
    display: none;
  }

  .content-reference-accordion {
    display: block;
  }
}

@media (min-width: 1400px) {
  .content-toc-long {
    display: inline;
  }

  .content-toc-short {
    display: none;
  }
}

/* Code blocks: one shared component (NYTE code block standard). This block
   is the only place the panel, header strip, label, Copy button, scroll
   chevrons and code colours are defined. content-layout.js builds it around
   every <pre> on public pages (.tr-code); the quickstart box (.md-code) and
   the homepage migration panel put the same classes in their markup:
   .tr-code-head for the strip, .tr-code-tools for its button group,
   .tr-code-copy for Copy and .tr-code-body for a scrolling code area.
   Ink panel, square, no border or shadow; lines never wrap. Rules start at
   :root so page sheets loaded later cannot restyle the parts. Colours fall
   back to the kit values outside the NYTE theme. */
:root {
  --tr-code-ink: var(--nyte-ink, #151311);
  --tr-code-cream: var(--nyte-cream, #FAF8F4);
  --tr-code-lime: var(--nyte-lime, #C9E265);
  --tr-code-muted: var(--nyte-ink-2-dark, #B9B2A8);
  --tr-code-rule: var(--nyte-dark-rule, #3A3631);
  --tr-code-sunken: var(--nyte-sunken, #221F1C);
  --tr-code-pad-block: 24px;
  --tr-code-pad-inline: 28px;
}

:root .tr-code {
  position: relative;
  display: block;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--tr-code-ink);
  color: var(--tr-code-cream);
}

:root .tr-code-head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-sizing: border-box;
  height: 48px;
  padding: 0 2px 0 var(--tr-code-pad-inline);
  border-bottom: 1.5px solid var(--tr-code-rule);
  background: var(--tr-code-ink);
  color: var(--tr-code-cream);
}

:root .tr-code-label {
  min-width: 0;
  overflow: hidden;
  color: var(--tr-code-muted);
  font: 500 14px/1.2 "ABC Pelikan Condensed", "Arial Narrow", var(--tr-font-family-sans);
  letter-spacing: 0.1em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

:root .tr-code-label.is-file {
  font: 400 14px/1.2 var(--font-mono, var(--tr-font-family-mono));
  letter-spacing: 0;
  text-transform: none;
}

:root .tr-code-tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
}

/* Copy: an icon-only button in the strip. */
:root .tr-code-copy {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  color: var(--tr-code-cream);
  cursor: pointer;
}

:root .tr-code-copy[hidden] {
  display: none;
}

:root .tr-code-copy svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.5;
}

:root .tr-code-copy .tr-code-done,
:root .tr-code-copy.is-done .tr-code-icon {
  display: none;
}

:root .tr-code-copy.is-done .tr-code-done {
  display: block;
}

:root .tr-code-copy:hover {
  background: var(--tr-code-sunken);
}

:root .tr-code-copy:focus-visible {
  outline: 2px solid var(--tr-code-cream);
  outline-offset: -4px;
}

/* The code itself. In .tr-code the <pre> scrolls; in a .tr-code-body the
   body scrolls and the <pre> is as wide as its longest line. */
:root :is(.tr-code pre, .tr-code-body pre) {
  display: block;
  box-sizing: border-box;
  width: auto;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: var(--tr-code-pad-block) var(--tr-code-pad-inline);
  overflow-x: auto;
  overflow-y: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  color: var(--tr-code-cream);
  font: 400 14px/1.7 var(--font-mono, var(--tr-font-family-mono));
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
  tab-size: 2;
  mask-image: none;
  /* stylelint-disable-next-line property-no-vendor-prefix -- iOS Safari only reads the prefixed form. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

:root .tr-code-body {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  background: var(--tr-code-ink);
  color: var(--tr-code-cream);
}

:root .tr-code-body pre {
  width: max-content;
  min-width: 100%;
  max-width: none;
  overflow: visible;
}

:root :is(.tr-code pre, .tr-code-body pre) code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  white-space: inherit;
  overflow-wrap: inherit;
}

:root .tr-code pre:focus-visible,
:root .tr-code-body:focus-visible,
:root .tr-code-body:has(pre:focus-visible) {
  outline: 2px solid var(--tr-code-cream);
  outline-offset: -2px;
}

:root .tr-code-body pre:focus-visible {
  outline: 0;
}

/* Strings and values lime, comments muted */
:root :is(.tr-code, .tr-code-body) .tr-code-s {
  color: var(--tr-code-lime);
}

:root :is(.tr-code, .tr-code-body) .tr-code-c {
  color: var(--tr-code-muted);
}

/* The provider application is an email template: prose lines wrap. */
:root .tr-code pre.provider-application-template {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

:root .tr-code-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Body text before or after a code block keeps paragraph spacing. */
:root :is(p, ul, ol, dl, h3, h4, blockquote, .muted-copy) + .tr-code {
  margin-top: 16px;
}

:root .tr-code + :is(p, ul, ol, dl, h3, h4, blockquote, .tr-code) {
  margin-top: 16px;
}

/* Status sections inset their text; the panel lines up with it. */
:root .status-section > .tr-code {
  margin-inline: 18px;
}

/* The collapse for long docs examples only applies on phones. */
:root .tr-code-more {
  display: none;
}

/* Inline code in body text: body colour, mono one pixel under body size,
   no box. */
:root body:not(.console) :is(p, li, dd) > code:not([class]) {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font-family: var(--font-mono, var(--tr-font-family-mono));
  font-size: calc(1em - 1px);
}

@media (max-width: 700px) {
  :root {
    --tr-code-pad-block: 20px;
    --tr-code-pad-inline: 20px;
  }

  :root .tr-code pre.is-collapsed {
    max-height: calc(10 * 1.7 * 14px + 20px);
  }

  :root .tr-code-more {
    display: block;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 0 20px;
    border: 0;
    border-top: 1.5px solid var(--tr-code-rule);
    border-radius: 0;
    background: transparent;
    color: var(--tr-code-cream);
    font: 500 14px/1.2 var(--tr-font-family-sans);
    text-align: left;
    cursor: pointer;
  }

  :root .tr-code-more:focus-visible {
    outline: 2px solid var(--tr-code-cream);
    outline-offset: -4px;
  }
}

/* Sideways scroll: one component for rows, code and tables (NYTE
   sideways-scroll rule; content-layout.js TRScroll). A short fade into the
   ground colour at whichever edge has more; nothing to press. Rows (chips,
   link rows): the edge is sticky inside the row, full row height, and takes
   no width, so the row's layout does not change. Code and tables: the fade
   covers the scroller's own edge, never a code strip, Copy or the expand
   control. */
:root .tr-scroll-edge {
  --tr-scroll-fade: var(--tr-scroll-ground, var(--nyte-cream, #FAF8F4));

  z-index: 1;
  display: flex;
  flex: none;
  align-items: center;
  box-sizing: border-box;
  width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  list-style: none;
}

:root .tr-scroll-edge[hidden] {
  display: none;
}

:root .tr-scroll-edge.is-off {
  visibility: hidden;
}

:root .tr-scroll-edge.is-row {
  position: sticky;
  pointer-events: none;
  align-self: stretch;
}

:root .tr-scroll-edge-prev.is-row {
  left: 0;
  margin-right: calc(-44px - var(--tr-scroll-gap, 0px));
  background: linear-gradient(to left, transparent, var(--tr-scroll-fade) 55%);
}

:root .tr-scroll-edge-next.is-row {
  right: 0;
  margin-left: calc(-44px - var(--tr-scroll-gap, 0px));
  background: linear-gradient(to right, transparent, var(--tr-scroll-fade) 55%);
}

/* A sticky edge stops at the row's padding; this covers the padding too. */
:root .tr-scroll-edge.is-row::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--tr-scroll-pad, 0);
  background: var(--tr-scroll-fade);
}

:root .tr-scroll-edge-prev.is-row::after {
  right: 100%;
}

:root .tr-scroll-edge-next.is-row::after {
  left: 100%;
}

/* Code: a soft fade over the code area's edge; nothing to press. */
:root .tr-scroll-host {
  position: relative;
}

:root .tr-scroll-edge.is-over {
  position: absolute;
  width: 36px;
  min-height: 0;
  pointer-events: none;
}

:root .tr-scroll-edge-prev.is-over {
  background: linear-gradient(to left, transparent, var(--tr-scroll-fade));
}

:root .tr-scroll-edge-next.is-over {
  background: linear-gradient(to right, transparent, var(--tr-scroll-fade));
}
