/* Native reference disclosure; the original history layout remains inside #evolution. */
body[data-direction-preview] #direction-history-band {
    padding-block: 20px;
}

#history-reference.history-reference {
    min-width: 0;
    width: 100%;
    border-block: 1px solid var(--border, #354049);
    color: var(--text-primary, #edf2f6);
    letter-spacing: 0;
}

#history-reference > #history-reference-title {
    display: list-item;
    min-height: 64px;
    box-sizing: border-box;
    padding: 20px 12px 20px 4px;
    list-style-position: inside;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

#history-reference-title::marker,
#history-reference-title::-webkit-details-marker {
    color: var(--accent, #9ccafa);
}

#history-reference-title:hover {
    color: var(--accent, #9ccafa);
}

#history-reference-title:focus-visible {
    outline: 2px solid var(--accent, #9ccafa);
    outline-offset: 4px;
}

#history-reference-title .history-reference-fallback {
    display: inline-block;
    margin-inline-start: 12px;
    color: var(--text-secondary, #a8b4bf);
    font: 11px/1.5 var(--mono, monospace);
    white-space: nowrap;
    vertical-align: baseline;
}

#history-reference-title .history-reference-fallback[hidden] {
    display: none;
}

/* Override the old locale rule that hides history for SR/PT, with its existing DE fallback. */
#history-reference[open] > #evolution.history-feature {
    display: block !important;
    margin-top: 0;
    padding-top: 20px;
    padding-bottom: 24px;
}

/* Keep collapsed controls out of layout and tab order in older details implementations too. */
#history-reference:not([open]) > #evolution.history-feature {
    display: none !important;
}

/* The ambient preset hid both controls and the existing historical disclaimer. */
#history-reference[open] #evolution.history-feature .hs-footer {
    display: flex !important;
}

#history-reference[open] #evolution.history-feature .hs-note {
    display: block !important;
    max-width: 100%;
    margin-top: 24px;
    color: var(--text-secondary, #a8b4bf);
    font-size: 12px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

@media (max-width: 700px) {
    body[data-direction-preview] #direction-history-band {
        padding-block: 16px;
    }

    #history-reference > #history-reference-title {
        padding-block: 18px;
        font-size: 15px;
    }

    #history-reference[open] > #evolution.history-feature {
        padding-top: 16px;
        padding-bottom: 20px;
    }

    #history-reference[open] #evolution .hs-controls {
        flex: 0 0 100%;
        justify-content: flex-end;
        margin-left: 0;
    }
}
