/* Site-wide additions to the theme. Colors come from the variant. */

/* Notices: a colored edge and a light tint instead of a filled box. */
#R-body .box.notices { --xn-box: var(--INTERNAL-PRIMARY-color); }
#R-body .box.notices.note { --xn-box: var(--INTERNAL-ACCENT-color); }
#R-body .box.notices.info { --xn-box: var(--INTERNAL-PRIMARY-color); }
#R-body .box.notices.tip { --xn-box: rgba( 62, 155, 110, 1 ); }
#R-body .box.notices.warning,
#R-body .box.notices.caution { --xn-box: rgba( 200, 85, 61, 1 ); }

#R-body .box.notices {
    margin: 1.5rem 0;
    border: 0;
    border-left: 3px solid var(--xn-box);
    border-radius: 4px;
    background: color-mix(in srgb, var(--xn-box) 7%, transparent);
}
#R-body .box.notices > .box-label {
    margin: 0;
    padding: 0.65rem 1rem 0;
    background: none;
    color: var(--INTERNAL-MAIN-TITLES-TEXT-color);
    font-weight: 600;
}
#R-body .box.notices > .box-label i { color: var(--xn-box); }
#R-body .box.notices > .box-content {
    padding: 0.35rem 1rem 0.8rem;
    background: none;
    color: var(--INTERNAL-MAIN-TEXT-color);
}
#R-body .box.notices > .box-content > :first-child { margin-top: 0; }
#R-body .box.notices > .box-content > :last-child { margin-bottom: 0; }

/* Sidebar drop-down lists: the theme's focus outline gets clipped to a
   thick line under the label. Show focus by color instead. */
#R-sidebar .menu-control select:focus,
#R-sidebar .menu-control select:active { outline: none; }
#R-sidebar .menu-control:focus-within,
#R-sidebar .menu-control:focus-within select { color: var(--INTERNAL-MENU-SECTIONS-LINK-HOVER-color); }

/* Code block titles: the theme draws them as tabs. Match the code
   block below them instead of the generic box colors. */
#R-body .tab-nav-button.active {
    background-color: var(--INTERNAL-CODE-BLOCK-BG-color);
    border-color: var(--INTERNAL-CODE-BLOCK-BORDER-color);
    color: var(--INTERNAL-MAIN-TEXT-color);
}
#R-body .tab-nav-button.active > .tab-nav-text { background-color: var(--INTERNAL-CODE-BLOCK-BG-color); }

/* Figure beside its text (mixedgrid shortcode). */
#R-body .mixed-grid-container {
    display: grid;
    grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
    gap: 2rem;
    align-items: center;
    margin: 1rem 0 1.5rem;
}
#R-body .mixed-grid-figure img { max-width: 100%; height: auto; }
#R-body .cmd-summary td code { white-space: nowrap; }
@media (max-width: 52rem) {
    #R-body .mixed-grid-container { grid-template-columns: minmax(0, 1fr); }
}

/* Diagrams drawn with the theme colors (assets/diagrams). */
#R-body .mixed-grid-figure svg { width: 100%; height: auto; display: block; }
.xd-frame { fill: none; stroke: color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 28%, transparent); stroke-width: 1.5; }
.xd-oob { fill: color-mix(in srgb, var(--INTERNAL-ACCENT-color) 16%, var(--INTERNAL-MAIN-BG-color)); stroke: var(--INTERNAL-ACCENT-color); stroke-width: 1.5; }
.xd-link { fill: var(--INTERNAL-PRIMARY-color); }
.xd-inband { fill: color-mix(in srgb, var(--INTERNAL-MAIN-TITLES-TEXT-color) 8%, var(--INTERNAL-MAIN-BG-color)); stroke: color-mix(in srgb, var(--INTERNAL-MAIN-TITLES-TEXT-color) 45%, transparent); stroke-width: 1.5; }
.xd-mark-oob { fill: var(--INTERNAL-ACCENT-color); }
.xd-mark-inband { fill: color-mix(in srgb, var(--INTERNAL-MAIN-TITLES-TEXT-color) 55%, transparent); }
.xd-title { fill: var(--INTERNAL-MAIN-TITLES-TEXT-color); font-size: 16px; font-weight: 600; }
.xd-text { fill: var(--INTERNAL-MAIN-TEXT-color); font-size: 14px; }
.xd-strong { font-weight: 600; }
.xd-small { fill: color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 70%, transparent); font-size: 12px; }
.xd-on-link { fill: var(--INTERNAL-MAIN-BG-color); font-size: 12.5px; font-weight: 600; }
.xd-dev { fill: color-mix(in srgb, var(--INTERNAL-PRIMARY-color) 14%, var(--INTERNAL-MAIN-BG-color)); stroke: var(--INTERNAL-PRIMARY-color); stroke-width: 1.5; }
.xd-line { fill: none; stroke: color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 70%, transparent); stroke-width: 1.5; }
.xd-dashed { stroke-dasharray: 5 4; }
.xd-arrowhead { fill: color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 70%, transparent); }
.xd-measure { fill: none; stroke: var(--INTERNAL-PRIMARY-color); stroke-width: 1.5; }
.xd-arrowhead-measure { fill: var(--INTERNAL-PRIMARY-color); }
.xd-event { stroke: var(--INTERNAL-PRIMARY-color); stroke-width: 2.5; }
.xd-event-oob { stroke: var(--INTERNAL-ACCENT-color); stroke-width: 2.5; }
.xd-irq { fill: none; stroke: var(--INTERNAL-PRIMARY-color); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.xd-label { fill: color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 80%, transparent); font-size: 12px; font-style: italic; }
.xd-plain { fill: var(--INTERNAL-MAIN-BG-color); stroke: color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 45%, transparent); stroke-width: 1.5; }
.xd-path-oob { fill: none; stroke: var(--INTERNAL-ACCENT-color); stroke-width: 2; }
.xd-arrowhead-oob { fill: var(--INTERNAL-ACCENT-color); }
.xd-path-inband { fill: none; stroke: color-mix(in srgb, var(--INTERNAL-MAIN-TITLES-TEXT-color) 55%, var(--INTERNAL-MAIN-BG-color)); stroke-width: 2; }
.xd-arrowhead-inband { fill: color-mix(in srgb, var(--INTERNAL-MAIN-TITLES-TEXT-color) 55%, var(--INTERNAL-MAIN-BG-color)); }
.xd-code { fill: var(--INTERNAL-MAIN-TEXT-color); font-family: var(--INTERNAL-CODE-font, monospace); font-size: 12px; white-space: pre; }
.xd-dotted { stroke-dasharray: 2 3; }
.xd-dashdot { stroke-dasharray: 9 3 2 3; }
.xd-flow { fill: color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 10%, var(--INTERNAL-MAIN-BG-color)); stroke: color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 45%, var(--INTERNAL-MAIN-BG-color)); stroke-width: 1.2; }
.xd-fill { fill: color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 30%, var(--INTERNAL-MAIN-BG-color)); stroke: color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 50%, var(--INTERNAL-MAIN-BG-color)); stroke-width: 1; }
.xd-forbid { fill: none; stroke: rgba( 200, 85, 61, 1 ); stroke-width: 4; opacity: 0.8; }
.xd-g1 { fill: var(--INTERNAL-PRIMARY-color); }
.xd-g2 { fill: var(--INTERNAL-ACCENT-color); }
.xd-g3 { fill: color-mix(in srgb, var(--INTERNAL-PRIMARY-color) 45%, var(--INTERNAL-MAIN-BG-color)); }
.xd-g4 { fill: color-mix(in srgb, var(--INTERNAL-MAIN-TITLES-TEXT-color) 30%, var(--INTERNAL-MAIN-BG-color)); }
.xd-g5 { fill: color-mix(in srgb, var(--INTERNAL-ACCENT-color) 50%, var(--INTERNAL-MAIN-BG-color)); }
:is(.xd-g1, .xd-g2, .xd-g3, .xd-g4, .xd-g5) { stroke: var(--INTERNAL-MAIN-BG-color); stroke-width: 1.5; }
#R-body .xd-figure { max-width: 40rem; margin: 1rem auto 1.5rem; }
#R-body .xd-figure svg { width: 100%; height: auto; display: block; }
#R-body .mixed-grid-right-container .mixed-grid-figure { max-width: 40rem; margin: 1rem auto 1.5rem; }

/* Colors of the Mermaid flow charts, from the theme variant. */
#R-body {
    --xd-bg: var(--INTERNAL-MAIN-BG-color);
    --xd-text: var(--INTERNAL-MAIN-TEXT-color);
    --xd-build-fill: color-mix(in srgb, var(--INTERNAL-PRIMARY-color) 14%, var(--INTERNAL-MAIN-BG-color));
    --xd-build-stroke: var(--INTERNAL-PRIMARY-color);
    --xd-check-fill: color-mix(in srgb, var(--INTERNAL-MAIN-TITLES-TEXT-color) 7%, var(--INTERNAL-MAIN-BG-color));
    --xd-check-stroke: color-mix(in srgb, var(--INTERNAL-MAIN-TITLES-TEXT-color) 45%, transparent);
    --xd-fail-fill: color-mix(in srgb, rgba( 200, 85, 61, 1 ) 16%, var(--INTERNAL-MAIN-BG-color));
    --xd-fail-stroke: rgba( 200, 85, 61, 1 );
    --xd-done-fill: color-mix(in srgb, var(--INTERNAL-ACCENT-color) 18%, var(--INTERNAL-MAIN-BG-color));
    --xd-done-stroke: var(--INTERNAL-ACCENT-color);
}

#R-body .mermaid .node.check :is(rect, polygon, circle, path) { fill: var(--xd-check-fill); stroke: var(--xd-check-stroke); }
#R-body .mermaid .node.build :is(rect, polygon, circle, path) { fill: var(--xd-build-fill); stroke: var(--xd-build-stroke); }
#R-body .mermaid .node.ask :is(rect, polygon, circle, path) { fill: var(--xd-bg); stroke: var(--xd-check-stroke); }
#R-body .mermaid .node.fail :is(rect, polygon, circle, path) { fill: var(--xd-fail-fill); stroke: var(--xd-fail-stroke); }
#R-body .mermaid .node.done :is(rect, polygon, circle, path) { fill: var(--xd-done-fill); stroke: var(--xd-done-stroke); }
#R-body .mermaid .node.oob :is(rect, polygon, circle, path) { fill: var(--xd-done-fill); stroke: var(--xd-done-stroke); }
#R-body .mermaid .node.inband :is(rect, polygon, circle, path) { fill: var(--xd-check-fill); stroke: var(--xd-check-stroke); }
#R-body .mermaid .node.plain :is(rect, polygon, circle, path) { fill: var(--xd-bg); stroke: var(--xd-check-stroke); }
#R-body .mermaid .node:is(.build, .check, .ask, .fail, .done, .oob, .inband, .plain) .nodeLabel { color: var(--xd-text); }
#R-body .mermaid :is(.edgeLabel, .edgeLabel p, .labelBkg) { background-color: var(--xd-bg); color: var(--xd-text); }
#R-body .mermaid .cluster rect { fill: transparent; stroke: var(--xd-check-stroke); stroke-dasharray: 4 4; }
#R-body .mermaid .cluster-label .nodeLabel { color: color-mix(in srgb, var(--xd-text) 70%, transparent); }

/* Date of the last change, then license and copyright, at the bottom
   of every page. */
#R-body .xn-lastmod {
    font-size: 0.9rem;
    color: color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 68%, transparent);
}
#R-body .xn-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 68%, transparent);
}
#R-body .xn-footer span { flex: 1 1 30rem; }
#R-body .xn-footer img { display: block; }
