/*
 * plg_content_j2cdocs: code blocks, copy button, diagrams and the inline blocks.
 * Colors come from the commerce template variables; the token colors below are fixed and measured against
 * the code background #0a1468 (--template-ink-2, the same value in light and dark): every one is at least 8:1.
 */
pre[class*="language-"] {
    position: relative;
    margin-block: 1.5rem;
    padding: 0.9rem 1rem;
    overflow: auto;
    border-radius: var(--radius-sm, 0.25rem);
    background-color: var(--template-ink-2, #0a1468);
    color: var(--template-on-ink, #eef1fb);
    font-family: var(--template-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-size: var(--template-fs-xs, 0.8125rem);
    line-height: 1.55;
    tab-size: 4;
    white-space: pre;
}

pre[class*="language-"] > code {
    padding: 0;
    background: transparent;
    color: inherit;
    font: inherit;
}

pre[class*="language-"]:focus-visible {
    outline: 2px solid var(--template-accent-on-ink, #f5d90a);
    outline-offset: -2px;
}

.j2c-code {
    position: relative;
}

.j2c-code > pre[class*="language-"] {
    margin-block: 0;
    padding-top: 2.4rem;
}

.j2c-code__copy {
    position: absolute;
    top: 0.4rem;
    right: 0.5rem;
    z-index: 1;
    min-height: 1.75rem;
    padding: 0.1rem 0.6rem;
    border: 1px solid #c9d0f7;
    border-radius: var(--radius-sm, 0.25rem);
    background-color: transparent;
    color: #eef1fb;
    font-size: var(--template-fs-xs, 0.8125rem);
    line-height: 1.4;
    cursor: pointer;
}

.j2c-code__copy:hover {
    background-color: rgba(255, 255, 255, 0.14);
}

.j2c-code__copy:focus-visible {
    outline: 2px solid var(--template-accent-on-ink, #f5d90a);
    outline-offset: 2px;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #b4bdf0;
    font-style: italic;
}

.token.punctuation,
.token.operator {
    color: #c9d0f7;
}

.token.keyword,
.token.atrule,
.token.attr-name,
.token.class-name {
    color: #ffdf6e;
}

.token.string,
.token.char,
.token.attr-value,
.token.selector,
.token.inserted {
    color: #a6eca8;
}

.token.number,
.token.boolean,
.token.constant,
.token.symbol,
.token.deleted,
.token.tag {
    color: #ffa8bd;
}

.token.function,
.token.builtin,
.token.property {
    color: #92d4ff;
}

.token.variable,
.token.regex {
    color: #ffd1a1;
}

.token.important,
.token.bold {
    color: #ffb86b;
    font-weight: 700;
}

.token.italic {
    font-style: italic;
}

/* Diagrams: the rendered SVG sits in the figure; the source stays available as text. */
.j2c-diagram {
    margin-block: 1.5rem;
}

.j2c-diagram > pre.mermaid {
    display: block;
    margin: 0;
    padding: 0.5rem;
    overflow: auto;
    background: transparent;
    color: inherit;
    font-family: inherit;
    text-align: center;
    white-space: pre;
}

.j2c-diagram > pre.mermaid[data-processed] {
    white-space: normal;
}

.j2c-diagram > figcaption {
    margin-top: 0.4rem;
    color: var(--bs-secondary-color);
    font-size: var(--template-fs-xs, 0.8125rem);
    text-align: center;
}

.j2c-diagram__source {
    margin-top: 0.5rem;
}

.j2c-diagram__source > summary {
    cursor: pointer;
    font-size: var(--template-fs-xs, 0.8125rem);
}

.j2c-diagram__source pre {
    margin-top: 0.5rem;
}

/* Language note after an English fallback link (text carries the meaning, not color). */
.j2c-lang-note {
    font-size: 0.875em;
    white-space: nowrap;
}

/* Inline "On this page" list and Related Products block (layouts that do not draw their own). */
.j2c-toc-inline {
    margin-block: 1rem 1.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--radius-sm, 0.25rem);
}

.j2c-toc-inline > ul {
    margin: 0;
    padding-left: 1.25rem;
}

.j2c-toc-inline__sub {
    margin-left: 1rem;
}

.j2c-related-products {
    margin-block: 2rem 0;
    padding-top: 1rem;
    border-top: 1px solid var(--bs-border-color);
}

.j2c-related-products ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.j2c-related-products li + li {
    margin-top: 0.5rem;
}

.j2c-related-products a {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
}

.j2c-related-products__thumb {
    border-radius: var(--radius-sm, 0.25rem);
    object-fit: cover;
}

.j2c-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
