/*
 * Responsible for: the look of the clean-up slider and of the row of choice buttons, the same on every
 * screen that shows them.
 *
 * Must never: hold a colour, size, radius or speed that is not a custom property from tokens.css (the
 * few raw pixel values are pure geometry: a thumb, a track). Only transform is animated, so reduced
 * motion (speeds of 0) removes all movement.
 */
@layer kit {
  /* ---------- Slider ---------- */
  .ia-slider { --ia-thumb: 28px; --ia-track: 10px; --ia-p: 0; position: relative; width: 100%; }
  .ia-slider__thumb {
    position: absolute;
    top: calc((var(--tap) - var(--ia-thumb)) / 2);
    left: calc((100% - var(--ia-thumb)) * var(--ia-p));
    width: var(--ia-thumb);
    height: var(--ia-thumb);
    pointer-events: none;
  }
  .ia-slider__input {
    --ia-fill: calc(var(--ia-thumb) / 2 + (100% - var(--ia-thumb)) * var(--ia-p));
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    height: var(--tap);
    margin: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
  }
  .ia-slider__input:focus { outline: none; }
  .ia-slider__input::-webkit-slider-runnable-track {
    height: var(--ia-track);
    border-radius: var(--r-pill);
    background: linear-gradient(to right, var(--accent) var(--ia-fill), var(--rule) var(--ia-fill));
  }
  .ia-slider__input::-moz-range-track {
    height: var(--ia-track);
    border-radius: var(--r-pill);
    background: linear-gradient(to right, var(--accent) var(--ia-fill), var(--rule) var(--ia-fill));
  }
  .ia-slider__input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: var(--ia-thumb);
    height: var(--ia-thumb);
    margin-top: calc((var(--ia-track) - var(--ia-thumb)) / 2);
    border: 1px solid var(--rule);
    border-radius: var(--r-pill);
    background: var(--pop);
    box-shadow: var(--shadow-1);
    transition: transform var(--fast) var(--ease);
  }
  .ia-slider__input::-moz-range-thumb {
    box-sizing: border-box;
    width: var(--ia-thumb);
    height: var(--ia-thumb);
    border: 1px solid var(--rule);
    border-radius: var(--r-pill);
    background: var(--pop);
    box-shadow: var(--shadow-1);
    transition: transform var(--fast) var(--ease);
  }
  .ia-slider__input:active::-webkit-slider-thumb { transform: scale(1.12); box-shadow: var(--shadow-2); }
  .ia-slider__input:active::-moz-range-thumb { transform: scale(1.12); box-shadow: var(--shadow-2); }
  .ia-slider__input:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
  .ia-slider__input:focus-visible::-moz-range-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
  .ia-slider__ends {
    display: flex;
    justify-content: space-between;
    gap: var(--s-4);
    margin-top: var(--s-1);
    font-size: var(--t-sm);
    color: var(--muted);
  }
  .ia-slider__end--right { text-align: right; }

  /* ---------- Choice row ---------- */
  .ia-choice { display: flex; flex-wrap: wrap; gap: var(--s-2); }
  .ia-choice__option {
    appearance: none;
    min-height: var(--tap);
    margin: 0;
    padding: 0 var(--s-3);
    border: 1px solid var(--rule);
    border-radius: var(--r-pill);
    background: var(--panel);
    font: inherit;
    font-size: var(--t-sm);
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform var(--fast) var(--ease);
  }
  .ia-choice__option:active { transform: scale(.97); }
  .ia-choice__option.is-chosen { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
  .ia-choice__option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  @media (hover: hover) {
    .ia-choice__option:hover:not(.is-chosen) { background: var(--hover); }
  }
}
