/* The nightly price filter with the area average: the price filter of an invented site of vacation rentals, in a
   dark card on a near black page with a warm light behind it and a fine grain. Thin bars of the histogram light up
   inside the range, a dashed line marks the area average, the handles squeeze under the finger. */
:root {
  --page: #0a0b0d;          /* the page */
  --card: #131418;          /* the body of the card */
  --card-top: #1a1c21;      /* the top of the card, where the light falls */
  --edge: rgba(255, 255, 255, 0.075); /* the hairline edge of the card */
  --ink: #eef0f3;           /* the words */
  --muted: #868b95;         /* the small words */
  --off: #2a2d34;           /* the bars outside the range */
  --accent: #ff8a5c;        /* the colour of the range: bars, fill, glow */
  --thumb: #f7f5f2;         /* the handles */
  --button: #f4f3f1;        /* the button */
  --button-ink: #0b0c0e;    /* the words on the button */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(60% 46% at 50% 58%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%),
    radial-gradient(50% 40% at 50% 0%, rgba(150, 170, 210, 0.08), transparent 70%),
    var(--page);
}

/* a very fine grain over everything */
.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.6 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.filter {
  position: relative;
  z-index: 1;
  width: min(88vw, 360px);
  padding: clamp(14px, 4.4vh, 22px) clamp(16px, 5.4vw, 22px) clamp(14px, 4vh, 20px);
  border-radius: 22px;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, 0.045), transparent 60%),
    linear-gradient(180deg, var(--card-top), var(--card) 46%);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 14px 30px -12px rgba(0, 0, 0, 0.7),
    0 44px 80px -40px rgba(0, 0, 0, 0.9);
  opacity: 0;
  user-select: none;
  -webkit-user-select: none;
}

.filter__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.filter__words {
  min-width: 0;
}

.filter__title {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 600;
  font-variation-settings: 'wdth' 106;
  letter-spacing: 0.005em;
}

.filter__sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* the switch between the price of a night and of the whole stay */
.seg {
  position: relative;
  flex: none;
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.seg__thumb {
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #2c2f36, #24262c);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 6px rgba(0, 0, 0, 0.5);
}

.seg__btn {
  position: relative;
  padding: 5px 11px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 560;
  font-variation-settings: 'wdth' 100;
  cursor: pointer;
  transition: color 0.3s, font-variation-settings 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-tap-highlight-color: transparent;
}

.seg__btn[aria-checked='true'] {
  color: var(--ink);
  font-variation-settings: 'wdth' 110;
}

.seg__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* the histogram */
.chart {
  position: relative;
  height: clamp(54px, 17vh, 96px);
  margin-top: clamp(12px, 3.6vh, 22px);
}

.chart__bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.bar {
  position: relative;
  flex: none;
  width: 3px;
  border-radius: 2px 2px 1px 1px;
  background: var(--off);
  transform-origin: 50% 100%;
}

.bar__lit {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent) 40%, color-mix(in srgb, var(--accent) 80%, #000));
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 45%, transparent);
  opacity: 0;
}

/* the warm light under the bars of the range */
.chart__glow {
  position: absolute;
  left: 0;
  bottom: -14px;
  width: 0;
  height: 60%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 34%, transparent), transparent);
  filter: blur(10px);
  pointer-events: none;
}

/* the area average */
.avg {
  position: absolute;
  left: 0;
  top: -6px;
  bottom: -4px;
  width: 0;
  pointer-events: none;
}

.avg__line {
  position: absolute;
  left: -0.5px;
  top: 14px;
  bottom: 0;
  width: 1px;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0 3px, transparent 3px 6px);
}

.avg__tag {
  position: absolute;
  left: 0;
  top: -6px;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 560;
  line-height: 14px;
  color: var(--ink);
  background: rgba(19, 20, 24, 0.86);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.avg__tag > .roll {
  margin-left: 2px;
}

/* the slider */
.rail {
  position: relative;
  height: 52px;
  margin-top: 4px;
  touch-action: none;
  cursor: pointer;
}

.track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
}

.track__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 55%, transparent);
}

/* the small mark of the average on the track */
.tick {
  position: absolute;
  left: 0;
  bottom: 6px;
  width: 1px;
  height: 10px;
  margin-left: -0.5px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 1px;
}

.thumb {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  border-radius: 50%;
  outline: none;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
}

.thumb__body {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(120% 100% at 50% 0%, #ffffff, var(--thumb) 55%, #dcd8d2);
  box-shadow:
    inset 0 -1px 1px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 2px 4px rgba(0, 0, 0, 0.45),
    0 6px 14px -4px rgba(0, 0, 0, 0.6),
    0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent);
  transition: box-shadow 0.35s;
}

.thumb.is-held .thumb__body {
  box-shadow:
    inset 0 -1px 1px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 3px 8px -2px rgba(0, 0, 0, 0.6),
    0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent);
}

.thumb:focus-visible .thumb__body {
  box-shadow:
    inset 0 -1px 1px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 2px 4px rgba(0, 0, 0, 0.45),
    0 0 0 3px var(--accent);
}

/* two tiny grooves on the handle */
.thumb__grip {
  width: 5px;
  height: 7px;
  border-left: 1px solid rgba(0, 0, 0, 0.22);
  border-right: 1px solid rgba(0, 0, 0, 0.22);
}

/* the prices over the handles */
.tag {
  position: absolute;
  left: 0;
  top: 0;
  padding: 0 8px;
  height: 22px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  font-variation-settings: 'wdth' 100;
  color: var(--ink);
  background: linear-gradient(180deg, #24262c, #1c1e23);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 10px -4px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
  pointer-events: none;
}

.axis {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-size: 11px;
  color: var(--muted);
}

/* the rolling digits */
.roll {
  display: inline-flex;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'zero' 0;
  line-height: 1;
}

.roll__slot {
  display: inline-block;
  height: 1em;
  overflow: hidden;
}

.roll__col {
  display: block;
}

.roll__col > span {
  display: block;
  height: 1em;
}

.filter__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: clamp(12px, 3.4vh, 20px);
  padding-top: clamp(12px, 3.4vh, 18px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.foot__words {
  min-width: 0;
}

.count {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 22px;
  font-weight: 640;
  font-variation-settings: 'wdth' 96;
  letter-spacing: -0.02em;
}

.count__word {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}

.deal {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 5px 0 0;
  font-size: 11.5px;
  font-weight: 560;
  color: var(--accent);
  white-space: nowrap;
  opacity: 0;
}

.deal svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.show {
  flex: none;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.show__face {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  border-radius: inherit;
  background: linear-gradient(180deg, #ffffff, var(--button));
  color: var(--button-ink);
  font-size: 13px;
  font-weight: 600;
  font-variation-settings: 'wdth' 100;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1), 0 6px 16px -8px rgba(0, 0, 0, 0.8);
  transition: font-variation-settings 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (hover: hover) {
  .show:hover .show__face {
    font-variation-settings: 'wdth' 112;
  }
}

.show:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* the drawn pointer of the loop */
.pointer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -4px;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
}

.pointer path {
  fill: #ffffff;
  stroke: #0b0c0e;
  stroke-width: 1.3;
  stroke-linejoin: round;
}

@media (max-width: 360px) {
  .seg__btn {
    padding: 5px 9px;
  }
  .show__face {
    padding: 0 13px;
  }
}
