/* 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) ----
   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: the map's copy to
   drag on the map, the row's copy beside the category select, where a visitor looks for a filter - 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). Both copies are printed
   only on a page with results - the filter row and the map column are. */

/* Over the map, 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. Page markup beside #map, not a Google control: it needs no Google script, and a touch or a mouse on it never reaches the
   map's own handlers. It carries the longer words ("Promień: 25 mil") at every width: it is 220px wide wherever it is.
   Where: on a phone or a tablet (the Mapa view) the top-left corner, under Google's own Map / Satellite control (10px from the top, about
   40px tall). From 992px up (the map beside the list) the MIDDLE of the left edge: the site's header is sticky and stays over the top
   179px of the map once the list is scrolled and the map is pinned (.map-fixd), and the bottom of the map is below the fold of a laptop
   until then - the middle is on screen in both states, and Google draws nothing there. */
.ip-radius.ip-radius--map {
    --ip-radius-text: 108px;
    --ip-radius-inset: 0px;
    position: absolute;
    top: calc(var(--ip-radius-inset) + 64px);
    left: calc(var(--ip-radius-inset) + var(--space-3));
    z-index: 6;
    flex: none;
    width: 220px;
    max-width: calc(100% - 2 * var(--space-3));
    box-shadow: var(--elevation-map-control);
}
@media (min-width: 992px) {
    .ip-radius.ip-radius--map {
        /* from 992px up the map is inset by the 50px padding of .map-padded (web.css): the corner of the map is 50px in from the box's */
        --ip-radius-inset: 50px;
        /* the middle of the box's height - the map's padding is the same top and bottom - less half of the pill's own 28px */
        top: calc(50% - 14px);
    }
}
.ip-radius.ip-radius--map:focus-within {
    box-shadow: 0 0 0 2px var(--focus-ring), var(--elevation-map-control);
}
.ip-radius--map.ip-radius--set .ip-radius__word {
    display: inline;
}
.ip-radius--map.ip-radius--set .ip-radius__word::after {
    content: ':';
}
