/* The native Org outline shares the resume's cycle-expansion controls. */
.dotfiles-org
:is(.outline-2, .outline-3, .outline-4, .outline-5, .outline-6, .outline-7, .outline-8) {
    margin-top: var(--space-6);
}

.dotfiles-org :is(h2, h3, h4, h5, h6) {
    margin-bottom: var(--space-1);
}

.dotfiles-org :is(h5, h6) {
    line-height: 1.4;
}

.dotfiles-org #text-table-of-contents a {
    margin-right: 0;
    font-size: inherit;
    color: inherit;
}

.dotfiles-org #text-table-of-contents a[aria-current] {
    color: var(--color-link);
    font-weight: bold;
}

.dotfiles-code {
    margin-block: var(--space-4);
    min-width: 0;
    /* The block, not its pre, holds the id, so a jump to it shows the bar
       and stops half a block gap short of the top of the window. */
    scroll-margin-top: calc(var(--space-4) / 2);
}

.dotfiles-code__metadata {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-1) var(--space-4);
    margin: 0;
    padding: var(--code-header-padding-block) var(--code-header-padding-inline);
    background: var(--color-code-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px 4px 0 0;
    color: var(--color-tertiary);
    font-family: var(--font-body);
    font-size: var(--code-header-font-size);
    line-height: var(--code-header-line-height);
    letter-spacing: var(--code-header-letter-spacing);
    overflow-wrap: anywhere;
}

.dotfiles-code__target code {
    background: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

.dotfiles-code pre.src[data-language] {
    margin: 0;
    max-width: 100%;
    padding-top: var(--code-body-padding-block);
    border-top: 0;
    border-radius: 0 0 4px 4px;
    overflow-x: auto;
}

/* code-blocks.js adds the Wrap and Copy controls at the bar's right. The bar
   then flows as text between the language and the controls: a tangle target
   sits beside them when it fits and otherwise takes a full line below. */
.dotfiles-code__metadata:has(> .code-tools) {
    display: flow-root;
    text-align: right;
}

.dotfiles-code__metadata:has(> .code-tools) > .code-label {
    float: left;
    margin-right: var(--space-4);
}

.dotfiles-code__metadata > .code-tools {
    float: right;
    margin-left: var(--space-4);
}

.dotfiles-code__metadata:has(> .code-tools) > .dotfiles-code__target {
    display: inline-block;
    max-width: 100%;
    text-align: left;
}

/* On phones the target always takes its own line, from the left. */
@media (max-width: 600px) {
    .dotfiles-code__metadata:has(> .code-tools) > .dotfiles-code__target {
        display: block;
        clear: both;
    }
}
