/* Structural/accessibility utilities added after the original SOJ UI. This file must not redefine the visual system. */

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

.skip-link {
    position: fixed;
    z-index: 2000;
    top: 10px;
    left: 10px;
    padding: 8px 12px;
    transform: translateY(-180%);
}

.skip-link:focus {
    transform: translateY(0);
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
}

/* Current problem metadata markup is a dl; reset browser defaults while keeping the original OJ density. */
.problem-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 20px;
    margin: 0;
}

.problem-meta > div {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 6px;
}

.problem-meta dt,
.problem-meta dd {
    margin: 0;
}

.problem-meta dd {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Problem difficulty/tag spoilers are one-way disclosures. Native details keeps the
 * initial control keyboard-accessible; after opening, the control disappears and the
 * revealed value occupies the same metadata area instead of offering a hide action. */
details.problem-spoiler > summary {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    min-height: 30px;
    padding: 4px 8px;
    list-style: none;
    white-space: nowrap;
}

details.problem-spoiler > summary::-webkit-details-marker {
    display: none;
}

details.problem-spoiler[open] > summary {
    display: none;
}

.problem-spoiler > .problem-spoiler-content {
    display: flex;
    align-items: center;
    max-width: 100%;
    min-height: 30px;
    padding: 4px 8px;
}

.problem-tags-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.problem-page-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
    margin-left: auto;
}

.problem-edit-request-form {
    margin: 0;
}

.problem-filter-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
}

.problem-filter-summary::-webkit-details-marker {
    display: none;
}

.problem-filter-summary::after {
    content: "+";
    line-height: 1;
}

.problem-filter-panel[open] .problem-filter-summary::after {
    content: "−";
}

.difficulty-range-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.difficulty-range-selected {
    display: inline-grid;
    grid-template-columns: minmax(84px, 1fr) auto minmax(84px, 1fr);
    align-items: center;
    width: 260px;
    max-width: 100%;
    min-height: 32px;
    padding: 4px 8px;
    white-space: nowrap;
}

.difficulty-range-bound {
    min-width: 0;
    text-align: center;
}

.difficulty-range-slider {
    --range-left: 0%;
    --range-right: 100%;
    position: relative;
    height: 38px;
    margin: 3px 2px 0;
}

.difficulty-range-slider::before,
.difficulty-range-slider::after {
    content: "";
    position: absolute;
    top: 16px;
    height: 6px;
}

.difficulty-range-slider::before {
    right: 0;
    left: 0;
}

.difficulty-range-slider::after {
    right: calc(100% - var(--range-right));
    left: var(--range-left);
}

.difficulty-range-slider input[type="range"] {
    position: absolute;
    z-index: 2;
    top: 2px;
    left: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    appearance: none;
    pointer-events: none;
}

.difficulty-range-slider input[type="range"]::-webkit-slider-runnable-track {
    height: 32px;
}

.difficulty-range-slider input[type="range"]::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    margin-top: 6px;
    appearance: none;
    pointer-events: auto;
}

.difficulty-range-slider input[type="range"]::-moz-range-track {
    height: 32px;
}

.difficulty-range-slider input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    pointer-events: auto;
}

.difficulty-range-scale {
    display: flex;
    justify-content: space-between;
}

.problem-table {
    min-width: 700px;
}

.container.soj-ad-container {
    width: 100%;
    padding-block: 0;
}

.soj-ad-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 100px;
    margin: 20px 0;
    overflow: hidden;
}

.soj-ad {
    display: block;
    width: 100%;
    min-width: 0;
}

@media (max-width: 800px) {
    .difficulty-range-header {
        align-items: stretch;
        flex-direction: column;
    }

    .difficulty-range-selected {
        width: 100%;
    }
}
