/*
 * The public documentation.
 *
 * Read by somebody with no account, often at 11pm against a deadline, usually
 * while copying a code block into a terminal. So: a wide reading column, code
 * that is unmistakably code, and a table of contents that stays put. Nothing
 * here collapses, folds or animates - a reference that hides things is a
 * reference somebody greps instead of reads.
 */

.docs__bar {
    display: flex;
    align-items: baseline;
    gap: 2rem;
    padding: 0.9rem 1.5rem;
    border-bottom: 1px solid #d9dee5;
    background: #fff;
}

.docs__brand {
    font-weight: 700;
    font-size: 1.05rem;
    color: #12212e;
    text-decoration: none;
}

.docs__nav {
    display: flex;
    gap: 1.25rem;
}

.docs__nav a {
    color: #47576a;
    text-decoration: none;
}

.docs__nav a:hover,
.docs__nav a[aria-current='page'] {
    color: #12212e;
    text-decoration: underline;
}

.docs__page {
    display: grid;
    grid-template-columns: minmax(0, 15rem) minmax(0, 52rem);
    gap: 3rem;
    align-items: start;
    padding: 2rem 1.5rem 6rem;
}

/* A page without a table of contents (`/bot`). Without this the lone `main`
   is the grid's first child and lands in the 15rem sidebar column. */
.docs__page--single {
    grid-template-columns: minmax(0, 52rem);
}

/* One column below the width where a sidebar stops being navigation and starts
   being a wall between the reader and the text. */
@media (max-width: 60rem) {
    .docs__page {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem;
    }

    .docs__toc {
        position: static;
    }
}

.docs__toc {
    position: sticky;
    top: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.docs__toc-title {
    margin: 1.25rem 0 0.35rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.72rem;
    color: #7c8a99;
}

.docs__toc ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

.docs__toc li {
    padding: 0.15rem 0;
}

.docs__toc a {
    color: #47576a;
    text-decoration: none;
}

.docs__toc a:hover {
    color: #12212e;
    text-decoration: underline;
}

.docs__main {
    min-width: 0;
    line-height: 1.65;
    color: #22313f;
}

.docs__main h1 {
    margin-top: 0;
}

.docs__main h2 {
    margin-top: 2.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e9ee;
}

.docs__main h3 {
    margin-top: 1.75rem;
}

.docs__version {
    font-size: 0.9rem;
    font-weight: 400;
    color: #7c8a99;
}

.docs__lead {
    font-size: 1.1rem;
    color: #47576a;
}

.docs__note {
    color: #47576a;
}

.docs__servers {
    list-style: none;
    padding: 0;
}

/* --------------------------------------------------------------- endpoints */

.endpoint {
    margin: 2rem 0 3rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid #e5e9ee;
    border-radius: 6px;
    background: #fff;
}

.endpoint h3 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.endpoint__summary {
    font-size: 1.02rem;
    color: #47576a;
    margin-top: -0.25rem;
}

.endpoint h4 {
    margin: 1.5rem 0 0.5rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #7c8a99;
}

/* The verb carries the weight, so it is the thing the eye lands on when
   scanning the page for the one call being looked for. */
.verb {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 3px;
    font: 700 0.75rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: 0.03em;
    color: #fff;
    background: #47576a;
}

.verb--get { background: #1f6f4a; }
.verb--post { background: #1b4f8a; }
.verb--patch { background: #8a5a12; }
.verb--put { background: #8a5a12; }
.verb--delete { background: #8a2323; }

.pill {
    display: inline-block;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.pill--planned {
    background: #f3e6c8;
    color: #6b4e10;
}

.planned-note {
    padding: 0.6rem 0.85rem;
    border-left: 3px solid #d8b95e;
    background: #fdf8ec;
    color: #47576a;
}

.status {
    font-weight: 700;
}

.status--2 { color: #1f6f4a; }
.status--4 { color: #8a5a12; }
.status--5 { color: #8a2323; }

/* ------------------------------------------------------------------ blocks */

.callout {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    border-left: 4px solid;
}

.callout p:first-child { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }

/* The verification gate. Loud, because the alternative is a support ticket. */
.callout--gate {
    border-color: #b03a3a;
    background: #fdf0f0;
}

/* Why published:false exists. Loud, because it is the sales argument. */
.callout--why {
    border-color: #1b4f8a;
    background: #eef4fb;
}

.code {
    margin: 0.75rem 0;
    padding: 0.9rem 1rem;
    overflow-x: auto;
    border-radius: 5px;
    background: #14202b;
    color: #e6edf3;
    font-size: 0.85rem;
    line-height: 1.55;
}

.code code {
    background: none;
    color: inherit;
    padding: 0;
    white-space: pre;
}

.detail {
    margin: 0.75rem 0;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e9ee;
    border-radius: 5px;
}

.detail summary {
    cursor: pointer;
    color: #47576a;
}

/* ------------------------------------------------------------------ tables */

.table {
    width: 100%;
    margin: 0.75rem 0;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid #e5e9ee;
    text-align: left;
    vertical-align: top;
}

.table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #7c8a99;
}

.table--schema td:first-child {
    white-space: nowrap;
}

/* A schema nested inside a cell is a detail of that row, not a peer of the
   table it sits in. */
.table--schema .table {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
}

.schema-entry {
    margin: 1.5rem 0;
}

/* ------------------------------------------- markdown coming from the spec */

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

.prose table {
    border-collapse: collapse;
    font-size: 0.9rem;
}

.prose th,
.prose td {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid #e5e9ee;
    text-align: left;
}

.prose pre {
    padding: 0.75rem 0.9rem;
    overflow-x: auto;
    border-radius: 5px;
    background: #14202b;
    color: #e6edf3;
    font-size: 0.85rem;
}

.prose pre code {
    background: none;
    color: inherit;
    padding: 0;
}

/* Inside a table cell the prose is one or two sentences and must not open up
   the row height with paragraph margins. */
.prose--tight p {
    margin: 0 0 0.35rem;
}

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

.muted {
    color: #7c8a99;
}

/* ========================================================================== */
/*  THE RETURNS REFERENCE                                                     */
/* ========================================================================== */

/*
 * `api.<returns-brand>/docs`, drawn like the panel a merchant is already in
 * (`web-returns`): white cards on the slate ground, the indigo brand, the
 * panel's radii and type scale. The shell is utilities in
 * `docs/_returns_shell.html.twig`; this block is what those cannot reach -
 * the markup the shared macros print (`.table`, `.code`, `.prose`), the
 * method badges, the cards.
 *
 * Everything is scoped to `.docs--returns`, so the Claims reference above
 * keeps its look, and every colour is a token of `app.css`, which the Returns
 * skin (`html[data-product="returns"]`) points at `web-returns`' values.
 *
 * This file is unlayered and `app.css` is layered, so a rule here beats a
 * utility whatever the specificity: nothing below styles a bare `a`, or the
 * shell's utility-coloured links would turn indigo.
 */

.docs--returns {
    --docs-code-bg: var(--color-ink);
    --docs-code-fg: var(--color-line);
    --docs-shadow: 0 1px 2px 0 rgb(15 23 42 / 0.05);

    background: var(--color-app);
}

/* ------------------------------------------------------------ the sidebar */

.docs--returns .docs-toc__title {
    margin: 1.25rem 0 0.375rem;
    padding: 0 0.75rem;
    font-size: var(--text-micro);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-faint);
}

.docs--returns .docs-toc__title:first-child {
    margin-top: 0;
}

.docs--returns .docs-toc ol {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.docs--returns .docs-toc a {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-control);
    font-size: var(--text-label);
    font-weight: 500;
    color: var(--color-muted);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.docs--returns .docs-toc a:hover {
    background: var(--color-app);
    color: var(--color-ink);
}

.docs--returns .docs-toc code {
    min-width: 0;
    font-size: 0.75rem;
    color: inherit;
    background: none;
}

.docs--returns .docs-toc .verb {
    flex: none;
    min-width: 3.25rem;
    text-align: center;
}

/* ------------------------------------------------------------ the column */

.docs--returns .docs-main {
    gap: 0;
    line-height: 1.6;
}

.docs--returns .docs-version {
    padding: 0.125rem 0.625rem;
    border: 1px solid var(--color-brand-edge);
    border-radius: var(--radius-pill);
    background: var(--color-brand-bg);
    font-family: var(--font-mono);
    font-size: var(--text-label);
    font-weight: 600;
    letter-spacing: 0;
    color: var(--color-brand);
}

.docs--returns .docs-lead {
    max-width: 48rem;
    margin: 0.75rem 0 2rem;
    font-size: var(--text-section);
    line-height: 1.6;
    color: var(--color-muted);
}

.docs--returns .docs-h2 {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin: 3.5rem 0 1rem;
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--color-ink);
    scroll-margin-top: 5rem;
}

.docs--returns .docs-h3 {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin: 2.25rem 0 1rem;
    font-size: var(--text-section);
    font-weight: 600;
    color: var(--color-ink);
    scroll-margin-top: 5rem;
}

.docs--returns .docs-count {
    padding: 0 0.5rem;
    border-radius: var(--radius-pill);
    background: var(--color-well);
    font-size: var(--text-micro);
    font-weight: 600;
    line-height: 1.6;
    color: var(--color-muted);
}

.docs--returns .docs-section-lead {
    max-width: 48rem;
    margin: -0.25rem 0 1.25rem;
    color: var(--color-muted);
}

.docs--returns .docs-intro {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 1rem;
}

@media (max-width: 60rem) {
    .docs--returns .docs-intro {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* -------------------------------------------------------------- the cards */

.docs--returns .docs-card {
    margin: 0 0 1rem;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-card);
    background: var(--color-surface);
    box-shadow: var(--docs-shadow);
    scroll-margin-top: 5rem;
}

.docs--returns .docs-card--padded {
    padding: 1.25rem 1.5rem;
}

.docs--returns .docs-card--padded > p {
    margin: 0 0 0.75rem;
}

.docs--returns .docs-card--padded > :last-child {
    margin-bottom: 0;
}

.docs--returns .docs-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    margin-bottom: 0.75rem;
    border-radius: var(--radius-control);
    background: var(--color-brand-bg);
    color: var(--color-brand);
}

.docs--returns .docs-card__title {
    margin: 0 0 0.5rem;
    padding: 0;
    border: 0;
    font-size: var(--text-section);
    font-weight: 600;
    color: var(--color-ink);
    scroll-margin-top: 5rem;
}

.docs--returns .docs-card__head {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-line);
}

.docs--returns .docs-card__head h3 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
    margin: 0;
    font-size: var(--text-body);
}

.docs--returns .docs-card__body {
    padding: 1.25rem 1.5rem 1.5rem;
}

.docs--returns .docs-card__body > :first-child {
    margin-top: 0;
}

.docs--returns .docs-card__body > :last-child {
    margin-bottom: 0;
}

/* An endpoint is a card: the old bordered box above is undone. */
.docs--returns .endpoint {
    padding: 0;
}

.docs--returns .endpoint__summary {
    margin: 0.375rem 0 0;
    font-size: var(--text-body);
    color: var(--color-muted);
}

.docs--returns .docs-path {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-ink);
    background: none;
    word-break: break-all;
}

.docs--returns .endpoint h4 {
    margin: 1.75rem 0 0.625rem;
    font-size: var(--text-micro);
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--color-faint);
}

.docs--returns .docs-note {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-control);
    background: var(--color-app);
    font-size: var(--text-label);
    color: var(--color-muted);
}

.docs--returns .docs-note svg {
    margin-top: 0.15rem;
    color: var(--color-faint);
}

.docs--returns .docs-servers {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.docs--returns .docs-servers li {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-control);
    background: var(--color-app);
}

.docs--returns .docs-servers code {
    font-size: var(--text-label);
    font-weight: 600;
    color: var(--color-ink);
    word-break: break-all;
}

.docs--returns .docs-servers span {
    font-size: var(--text-micro);
    color: var(--color-faint);
}

.docs--returns .docs-media {
    margin: 0.5rem 0;
}

.docs--returns .docs-media code,
.docs--returns .docs-chips code,
.docs--returns .docs-tag {
    display: inline-block;
    padding: 0.0625rem 0.5rem;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-pill);
    background: var(--color-app);
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    color: var(--color-muted);
}

.docs--returns .docs-tag--required {
    border-color: var(--color-brand-edge);
    background: var(--color-brand-bg);
    font-family: var(--font-sans);
    font-weight: 600;
    color: var(--color-brand);
}

.docs--returns .docs-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin: 0 0 0.75rem;
}

.docs--returns .docs-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 1rem 0 0;
}

.docs--returns .docs-facts > div {
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-control);
    background: var(--color-app);
}

.docs--returns .docs-facts .docs-facts__wide {
    grid-column: 1 / -1;
}

.docs--returns .docs-facts dt {
    margin: 0 0 0.25rem;
    font-size: var(--text-micro);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-faint);
}

.docs--returns .docs-facts dd {
    margin: 0;
    font-weight: 600;
    color: var(--color-ink);
}

.docs--returns .docs-facts .docs-chips {
    margin: 0;
}

@media (max-width: 40rem) {
    .docs--returns .docs-facts {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------------------------------------------------- verbs and statuses */

/*
 * A tint and its foreground, as the panel's badges are drawn - not the solid
 * blocks of the Claims page. The verb is identity, not status, but the four
 * tones the panel already has are the four a reader tells apart at a glance:
 * a read is green, a write indigo, a change amber, a removal red. The word is
 * always printed, so colour never carries it alone.
 */
.docs--returns .verb {
    padding: 0.0625rem 0.4375rem;
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    font: 600 0.6875rem/1.6 var(--font-mono);
    letter-spacing: 0.04em;
}

.docs--returns .verb--get { background: var(--color-ok-bg); color: var(--color-ok); }
.docs--returns .verb--post { background: var(--color-brand-bg); color: var(--color-brand); border-color: var(--color-brand-edge); }
.docs--returns .verb--patch,
.docs--returns .verb--put { background: var(--color-warn-bg); color: var(--color-warn); }
.docs--returns .verb--delete { background: var(--color-danger-bg); color: var(--color-danger); }
.docs--returns .verb--event { background: var(--color-well); color: var(--color-muted); text-transform: uppercase; }

.docs--returns .pill--planned {
    background: var(--color-warn-bg);
    color: var(--color-warn);
}

.docs--returns .status {
    display: inline-block;
    min-width: 2.75rem;
    padding: 0.0625rem 0.5rem;
    border-radius: var(--radius-pill);
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    font-weight: 600;
    text-align: center;
    background: var(--color-well);
    color: var(--color-muted);
}

.docs--returns .status--2 { background: var(--color-ok-bg); color: var(--color-ok); }
.docs--returns .status--4 { background: var(--color-warn-bg); color: var(--color-warn); }
.docs--returns .status--5 { background: var(--color-danger-bg); color: var(--color-danger); }

.docs--returns .docs-responses {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-control);
}

.docs--returns .docs-responses li + li {
    border-top: 1px solid var(--color-line);
}

/* The status, its meaning, and - when it has a body - the chevron on the
   right that opens it in place. */
.docs--returns .docs-response {
    display: grid;
    grid-template-columns: 3.5rem minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: baseline;
    padding: 0.625rem 0.875rem;
    font-size: var(--text-label);
    color: var(--color-ink);
}

.docs--returns div.docs-response {
    grid-template-columns: 3.5rem minmax(0, 1fr);
}

/* ------------------------------------------------------------- disclosure */

.docs--returns .detail {
    margin: 0;
    padding: 0;
    border: 0;
}

.docs--returns .detail summary {
    cursor: pointer;
    list-style: none;
}

.docs--returns .detail summary::-webkit-details-marker {
    display: none;
}

.docs--returns .detail summary:hover {
    background: var(--color-app);
}

.docs--returns .detail__chevron {
    align-self: center;
    color: var(--color-faint);
    transition: transform 0.15s ease;
}

.docs--returns .detail[open] .detail__chevron {
    transform: rotate(90deg);
}

.docs--returns .detail[open] summary {
    border-bottom: 1px dashed var(--color-line);
}

.docs--returns .detail__body {
    padding: 0.5rem 0.875rem 0.875rem 5.125rem;
    background: var(--color-app);
}

@media (max-width: 40rem) {
    .docs--returns .detail__body {
        padding-left: 0.875rem;
    }
}

.docs--returns .detail__body .docs-table {
    background: var(--color-surface);
}

/* Parameter and field names are one token; they never break in two. */
.docs--returns .table td:first-child > code {
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    .docs--returns .detail__chevron {
        transition: none;
    }
}

/* ------------------------------------------------------------------ code */

.docs--returns .code,
.docs--returns .prose pre {
    margin: 0.75rem 0;
    padding: 1rem 1.125rem;
    border-radius: var(--radius-control);
    background: var(--docs-code-bg);
    color: var(--docs-code-fg);
    font-size: 0.8125rem;
    line-height: 1.65;
}

.docs--returns .code code,
.docs--returns .prose pre code {
    font-size: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
}

/* Inline code in prose and tables: a quiet well, not a second colour. */
.docs--returns .prose :not(pre) > code,
.docs--returns .table td > code,
.docs--returns .table th > code {
    padding: 0.0625rem 0.3125rem;
    border-radius: 0.25rem;
    background: var(--color-well);
    font-size: 0.8125rem;
    color: var(--color-ink);
}

.docs--returns .prose a {
    color: var(--color-brand);
}

/* ---------------------------------------------------------------- tables */

/* Every table sits in a hairline frame and scrolls on its own on a phone,
   rather than widening the page. */
.docs--returns .docs-table {
    overflow-x: auto;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-control);
}

.docs--returns .docs-card.docs-table {
    border-radius: var(--radius-card);
}

.docs--returns .table {
    margin: 0;
    font-size: var(--text-label);
}

.docs--returns .table th,
.docs--returns .table td {
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--color-line);
}

.docs--returns .table tbody tr:last-child > th,
.docs--returns .table tbody tr:last-child > td {
    border-bottom: 0;
}

.docs--returns .table thead th {
    background: var(--color-app);
    font-size: var(--text-micro);
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--color-faint);
}

.docs--returns .table tbody th {
    text-transform: none;
    letter-spacing: 0;
    font-size: var(--text-label);
    font-weight: 500;
    color: var(--color-ink);
    white-space: nowrap;
}

/* A schema nested in a row: framed, a detail of that row. */
.docs--returns .table--schema .table {
    margin: 0.625rem 0 0;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-control);
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

.docs--returns .muted {
    color: var(--color-faint);
}

.docs--returns .table--schema td p.muted {
    margin: 0.375rem 0 0;
    font-size: var(--text-micro);
}

.docs--returns .docs-card__body > .muted,
.docs--returns .detail__body > .muted {
    margin: 0.75rem 0 0.25rem;
    font-size: var(--text-label);
}
