/* ============================================================
   SHARED RANGE CONTROL

   A restrained linear control for map/data filters. The control should read
   as attached interface, not as a dominant page object.
   ============================================================ */

/* The legacy map-filter markup may remain in the DOM for progressive
   enhancement, but hidden controls must never be painted before JS replaces
   them with the shared range control. Author-level display rules otherwise
   override the browser's default [hidden] behavior. */
.ofi-map-filters[hidden] {
    display: none !important;
}

.ofi-range-control {
    display: grid;
    width: min(32rem, 100%);
    margin: 3.5rem auto 1.5rem;
    gap: var(--ofi-spacing-xs);
    text-align: center;
}

.ofi-range-control__head {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: var(--ofi-spacing-md);
}

.ofi-range-control__head .ofi-kicker {
    margin: 0;
}

.ofi-range-control__value,
.ofi-range-control__ticks .ofi-fine-print,
.ofi-range-control__status {
    color: var(--ofi-color-text-primary);
}

.ofi-range-control__layers {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--ofi-spacing-xs);
}

.ofi-range-control__input {
    --ofi-range-progress: 0%;

    display: block;
    width: 100%;
    height: 2rem;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
}

.ofi-range-control__input::-webkit-slider-runnable-track {
    height: 3px;
    border-radius: 0;
    background: linear-gradient(
        to right,
        var(--ofi-color-brand-orange) 0%,
        var(--ofi-color-brand-orange) var(--ofi-range-progress),
        var(--ofi-color-border-default) var(--ofi-range-progress),
        var(--ofi-color-border-default) 100%
    );
}

.ofi-range-control__input::-moz-range-track {
    height: 3px;
    border: 0;
    border-radius: 0;
    background: var(--ofi-color-border-default);
}

.ofi-range-control__input::-moz-range-progress {
    height: 3px;
    border: 0;
    border-radius: 0;
    background: var(--ofi-color-brand-orange);
}

.ofi-range-control__input::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
    margin-top: -5.5px;
    border: 0;
    border-radius: 50%;
    appearance: none;
    -webkit-appearance: none;
    background: var(--ofi-color-brand-orange);
    box-shadow: 0 0 0 4px rgba(219, 121, 60, .18);
}

.ofi-range-control__input::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 0;
    border-radius: 50%;
    background: var(--ofi-color-brand-orange);
    box-shadow: 0 0 0 4px rgba(219, 121, 60, .18);
}

.ofi-range-control__input:focus-visible {
    outline: none;
}

.ofi-range-control__input:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 6px rgba(219, 121, 60, .24);
}

.ofi-range-control__input:focus-visible::-moz-range-thumb {
    box-shadow: 0 0 0 6px rgba(219, 121, 60, .24);
}

.ofi-range-control__ticks {
    display: flex;
    justify-content: space-between;
}

.ofi-range-control__status {
    margin-top: var(--ofi-spacing-xs);
}

/* The fires map swaps a raster haze layer and its overlay copy in place.
   Exclude that interactive area from browser scroll anchoring so toggling a
   layer cannot nudge the reader's viewport. */
.ofi-habitat-fires-page #ofi-orangutan-map,
.ofi-habitat-fires-page .ofi-range-control {
    overflow-anchor: none;
}

/* When the range control is followed by its attached source bar, keep that
   note compact and centered beneath the control. The whole map-control footer
   also owns the trailing breathing room before the next chapter. Use padding,
   not margin, so that space remains inside the map section's painted
   topographic surface. */
.ofi-range-control + .ofi-sources--bar {
    width: min(14rem, calc(100% - 2rem));
    margin-top: var(--ofi-spacing-md);
    margin-right: auto;
    margin-left: auto;
    justify-content: center;
    padding-bottom: clamp(2.5rem, 4vw, 3.5rem);
    text-align: center;
}

/* This stylesheet is loaded only by the habitat-fires template. Keep the
   smoke photograph hazy, while giving Otto a little more visual separation. */
.ofi-habitat-fires-page #smoke .ofi-media-fill-column__image > img {
    filter: contrast(1.1) saturate(1.07);
}
