/* The radius slider of the place-only results page (owner 2026-11-18, docs/IP-Reference.md sections CB.11 and CB.12). Loaded by search.blade.php only.

   One 28px pill like the selects beside it in .category-filters-row--search - the same border, radius, hover and focus ring as .select-css
   (web.css) - with the words on the left ("Promień" while no radius is chosen, "25 mil" once one is, "Promień: 25 mil" from 480px up) and a
   native <input type="range"> on the right. Colours, radius and spacing are the design tokens (tokens.css); the three sizes at the top of
   .ip-radius are the control's own geometry, set once and used below.

   The page prints the slider up to twice: .ip-radius--row in the filter row and, when the page has a map, .ip-radius--map on the map (the end
   of this file). Nothing here is global: every rule starts with .ip-radius, a class only search.blade.php prints, and no existing rule was changed.
   public/js/ip-radius-slider.js keeps --ip-radius-ratio (0 to 1, where the handle stands) and the --set / --busy classes current; with no
   script the bar simply shows no filled part. */

.ip-radius {
    --ip-radius-thumb: 16px;   /* the round handle */
    --ip-radius-track: 4px;    /* the bar it slides on */
    --ip-radius-text: 56px;    /* the room kept for the words: the widest of "Promień" and "100 mil", so the bar never resizes under a moving thumb */
    --ip-radius-ratio: 0;      /* where the handle stands, 0 to 1 - only colours the filled part of the bar */

    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    /* a flex item of .category-filters-row--search, sharing the line with the category select: it grows twice as fast as the select, so
       the bar gets the room on a phone (about 100px at 390px wide), and it stops at 220px, like the selects, until 480px */
    flex: 2 1 150px;
    min-width: 0;
    max-width: 220px;
    height: 28px;
    margin: 0;
    padding: 0 var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--surface);
    /* the text of select.select-css (web.css): 14px, on the 26px the 28px box leaves inside its border */
    font-size: 14px;
    line-height: 26px;
    color: var(--ink);
}
.ip-radius:hover {
    border-color: var(--border-strong);
}
/* the same ring as .select-css:focus - one ring around the whole control, for the mouse and the keyboard alike */
.ip-radius:focus-within {
    box-shadow: 0 0 0 2px var(--focus-ring);
    outline: 2px solid transparent;
}

/* ---- the words ---- */
.ip-radius__text {
    flex: 0 0 var(--ip-radius-text);
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}
.ip-radius__value {
    display: none;
}
.ip-radius--set .ip-radius__word {
    display: none;
}
.ip-radius--set .ip-radius__value {
    display: inline;
}

/* ---- the slider: the native input, drawn with the tokens ---- */
.ip-radius__range {
    -webkit-appearance: none;
    appearance: none;
    flex: 1 1 auto;
    min-width: 0;
    height: 26px;
    margin: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    /* a horizontal drag moves the handle, a vertical one still scrolls the page */
    touch-action: pan-y;
}
.ip-radius__range:focus {
    outline: none; /* the ring is the control's own (.ip-radius:focus-within) */
}
.ip-radius__range::-webkit-slider-runnable-track {
    height: var(--ip-radius-track);
    border-radius: var(--radius-pill);
    /* the part up to the handle in brand blue, the rest in the border grey; the handle's own half width is added to the left part so
       the colour change sits under the middle of the handle at every position */
    background: linear-gradient(to right,
        var(--brand-blue) calc(var(--ip-radius-thumb) / 2 + (100% - var(--ip-radius-thumb)) * var(--ip-radius-ratio)),
        var(--border) 0);
}
.ip-radius__range::-moz-range-track {
    height: var(--ip-radius-track);
    border-radius: var(--radius-pill);
    background: var(--border);
}
.ip-radius__range::-moz-range-progress {
    height: var(--ip-radius-track);
    border-radius: var(--radius-pill);
    background: var(--brand-blue);
}
.ip-radius__range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    width: var(--ip-radius-thumb);
    height: var(--ip-radius-thumb);
    /* centred on the bar: half of the difference between the bar and the handle, up */
    margin-top: calc((var(--ip-radius-track) - var(--ip-radius-thumb)) / 2);
    border: 2px solid var(--brand-blue);
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--elevation-1);
}
.ip-radius__range::-moz-range-thumb {
    box-sizing: border-box;
    width: var(--ip-radius-thumb);
    height: var(--ip-radius-thumb);
    border: 2px solid var(--brand-blue);
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--elevation-1);
}
/* held, and after it is let go while the page is on its way: the handle fills in - the choice is taken */
.ip-radius__range:active::-webkit-slider-thumb,
.ip-radius--busy .ip-radius__range::-webkit-slider-thumb {
    background: var(--brand-blue);
}
.ip-radius__range:active::-moz-range-thumb,
.ip-radius--busy .ip-radius__range::-moz-range-thumb {
    background: var(--brand-blue);
}
.ip-radius--busy {
    cursor: progress;
}
.ip-radius--busy .ip-radius__range {
    cursor: progress;
}

/* ---- from 480px there is room for the word beside the number, and a longer bar ---- */
@media (min-width: 480px) {
    .ip-radius {
        --ip-radius-text: 108px; /* "Promień: 100 mil" */
        /* a bigger share of the line when the subcategory select joins the two on a tablet or a desktop, so the bar is not squeezed */
        flex-basis: 190px;
        max-width: 280px;
    }
    .ip-radius--set .ip-radius__word {
        display: inline;
    }
    .ip-radius--set .ip-radius__word::after {
        content: ':';
    }
}

/* ---- the copy on the map (owner 2026-11-18, docs section CB.12; placed and dressed like Google's own control, owner 2026-11-19, docs section CB.13) ----
   In the map views the slider is on the map; in the list view it is just the slider in the row. Below 992px the page's own Lista / Mapa views
   hide the map column (with its copy) in Lista and the list column (with the row's copy) in Mapa, so each view has exactly one. From 992px up
   the map and the list are side by side and BOTH copies are on screen, kept in step by public/js/ip-radius-slider.js - with only the map's copy
   on a desktop the owner saw the filter row without a radius and said "the radius is not showing" (2026-11-18, the live page).

   The map's copy belongs to Google's Map / Satellite control: right under it, the same width, the same height and corners, white, with a
   shadow (owner 2026-11-19: "sit right below the map satellite toggle ... the same styling ... the same length"). Google draws that control, so
   its place and width are read from the page once the map is drawn (public/js/ip-radius-map.js sets --ip-radius-map-left,
   --ip-radius-map-under and --ip-radius-map-width on the copy); until then, and when the buttons are not found, the copy has the place and the
   width of a toggle of the usual size (10px in from the corner of the map, 40px tall, 176px wide). Google's map fills the whole of #map, the
   50px of padding .map-padded gives it on a desktop included (the owner's live screenshot, 2026-11-19: the map runs to the edge of the column and
   the toggle sits only a few pixels in - Google's usual 10px margin), so the corner these numbers count from is the corner of #map - there is no inset. Its words are the short ones at
   every width - "Radius" while none is chosen, "30 mi" once one is - because that is what fits beside a bar to drag in the width of the toggle.
   Should the page's sticky header cover the top of the map - the toggle too - the copy waits just under the header's edge instead
   (--ip-radius-map-clear, written by the script: how much of the map's top the header covers), so it can still be reached. Since 2026-11-21 (docs section CT)
   the pinned map starts under the header, so that is 0 and the copy stays under the toggle.
   It is page markup over the map, not a Google control: it needs no Google script, and a touch on it never reaches the map's handlers.
   Above the map's loading cover (z-index 5 in web.css), so it can be used while the cover is still there - or when Google never loads. */
.ip-radius.ip-radius--map {
    --ip-radius-text: 64px;                       /* "Radius" and "100 mi" at 16px - the Polish "Promień" too */
    --ip-radius-map-height: 40px;                 /* the height of Google's Map / Satellite buttons */
    --ip-radius-map-margin: 10px;                 /* the margin Google keeps round its controls */
    --ip-radius-map-fallback-width: 176px;        /* a toggle of the usual size, until the real one has been measured */
    --ip-radius-map-min-width: 150px;             /* never narrower than this: the bar still has to be long enough to drag */

    position: absolute;
    /* the bottom edge of the toggle (the margin and the height, until it has been measured) and a small gap - or, should the page's sticky
       header cover the top of the map (and the toggle with it), the bottom edge of the header: the script writes how far down it reaches */
    top: calc(max(var(--ip-radius-map-under, calc(var(--ip-radius-map-margin) + var(--ip-radius-map-height))), var(--ip-radius-map-clear, 0px)) + var(--space-2));
    left: var(--ip-radius-map-left, var(--ip-radius-map-margin));
    z-index: 6;
    flex: none;
    width: var(--ip-radius-map-width, var(--ip-radius-map-fallback-width));
    min-width: var(--ip-radius-map-min-width);
    max-width: calc(100% - 2 * var(--ip-radius-map-margin));
    height: var(--ip-radius-map-height);
    padding: 0 var(--space-3);
    border: 0;
    border-radius: var(--radius-sm);
    box-shadow: var(--elevation-map-control);
    font-size: 16px;
    line-height: 1.25;
}
/* the whole height of the control can be grabbed */
.ip-radius--map .ip-radius__range {
    height: var(--ip-radius-map-height);
}
.ip-radius.ip-radius--map:focus-within {
    box-shadow: 0 0 0 2px var(--focus-ring), var(--elevation-map-control);
}
/* the short words at every width: the "Radius:" of the wider rows would not fit beside a bar in the width of the toggle */
.ip-radius--map.ip-radius--set .ip-radius__word {
    display: none;
}
