/* The Compress images button with the file size that drops. One ink pill (.ci__body, moved only by GSAP) with its
   skin, grain and 1px edges in .ci__skin, a light that follows the pointer (.ci__shine) and a reflection for the end
   (.ci__sweep). On the left the three thumbnails between two jaws (each thumbnail moved only by GSAP, its little
   scene drawn by CSS on a child), in the middle the words with the weight and its bar, on the right the knob. */
:root {
  --page: #ffffff;            /* the page around the button */
  --ink-body: #15171b;        /* the button */
  --ink: #f3f4f1;             /* the words */
  --muted: rgba(243, 244, 241, 0.54); /* the small line under the words */
  --accent: #6fe3b4;          /* the mint light: scan line, bar, saved state */
  --knob: #f1f2ee;            /* the porcelain knob */
  --knob-ink: #1a1c20;        /* the chevrons on the knob */
  --success: #0f6b4a;         /* the check on the knob */
  --thumb-1: #f2b38a;         /* the sky of the front thumbnail */
  --thumb-2: #8fb3f0;         /* the sky of the middle thumbnail */
  --thumb-3: #b9cf9f;         /* the sky of the back thumbnail */
}

* {
  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 {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background: var(--page);
}

.ci {
  position: relative;
  display: grid;
  place-items: center;
}

/* the soft shadow and the mint glow the button throws on the white floor */
.ci__floor {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 92%;
  height: 30px;
  margin: -14px 0 0 -46%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 60%, transparent), color-mix(in srgb, var(--accent) 12%, transparent) 62%, transparent);
  filter: blur(12px);
  opacity: 0;
  pointer-events: none;
}

.ci__btn {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  -webkit-tap-highlight-color: transparent;
}

.ci__btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, var(--ink-body));
  outline-offset: 5px;
}

.ci__body {
  --mx: 30%;
  --my: 40%;
  position: relative;
  display: block;
  width: min(86vw, 324px);
  height: 60px;
  border-radius: 999px;
  overflow: hidden;
  isolation: isolate;
  background: var(--ink-body);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 1px 2px rgba(15, 18, 24, 0.22),
    0 6px 14px -6px rgba(15, 18, 24, 0.35),
    0 22px 40px -18px rgba(15, 18, 24, 0.45);
}

.ci__skin,
.ci__shine,
.ci__sweep {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

/* ink: lighter on top, grain, a 1px edge that catches the light above and a darker one below */
.ci__skin {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' 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.2 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(60% 130% at 8% 130%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.015) 50%, rgba(0, 0, 0, 0.26));
  background-size: 120px 120px, 100% 100%, 100% 100%;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    inset 0 -12px 20px -14px rgba(0, 0, 0, 0.8);
}

.ci__shine {
  background: radial-gradient(110px 70px at var(--mx) var(--my), rgba(225, 255, 240, 0.13), rgba(225, 255, 240, 0.03) 50%, transparent 72%);
  opacity: 0;
}

.ci__sweep {
  overflow: hidden;
}

.ci__sweep-band {
  position: absolute;
  top: -30%;
  left: 0;
  width: 34%;
  height: 160%;
  background: linear-gradient(100deg, transparent 0%, rgba(220, 255, 240, 0.04) 30%, rgba(220, 255, 240, 0.2) 50%, rgba(220, 255, 240, 0.04) 70%, transparent 100%);
}

.ci__row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 8px 0 8px;
  gap: 10px;
}

/* ---------------------------------------------------------------- the press with the thumbnails */
.ci__press {
  flex: none;
  position: relative;
  width: 62px;
  height: 44px;
  display: grid;
  place-items: center;
}

.ci__jaw {
  position: absolute;
  top: 8px;
  width: 2px;
  height: 28px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.5) 30%, rgba(255, 255, 255, 0.5) 70%, rgba(255, 255, 255, 0));
}

.ci__jaw::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, transparent, var(--accent) 25%, var(--accent) 75%, transparent);
  box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 60%, transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.is-busy .ci__jaw::after {
  opacity: 1;
}

.ci__jaw--l {
  left: 3px;
}

.ci__jaw--r {
  right: 3px;
}

.ci__fan {
  position: relative;
  width: 30px;
  height: 23px;
}

.ci__thumb {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  overflow: hidden;
  background: var(--sky, var(--thumb-1));
  box-shadow:
    0 1px 1.5px rgba(0, 0, 0, 0.55),
    0 4px 8px -3px rgba(0, 0, 0, 0.7),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.ci__thumb--a {
  --sky: var(--thumb-1);
}

.ci__thumb--b {
  --sky: var(--thumb-2);
}

.ci__thumb--c {
  --sky: var(--thumb-3);
}

/* the little scene in every thumbnail: a sun and two hills, drawn, never a photo */
.ci__scene {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 72% 30%, rgba(255, 255, 255, 0.92) 0 3px, rgba(255, 255, 255, 0.25) 3.6px, transparent 6px),
    radial-gradient(120% 90% at 20% 120%, color-mix(in srgb, var(--sky) 40%, #1d2a22) 0 46%, transparent 47%),
    radial-gradient(110% 80% at 85% 125%, color-mix(in srgb, var(--sky) 60%, #24302a) 0 50%, transparent 51%),
    linear-gradient(180deg, color-mix(in srgb, var(--sky) 70%, white), var(--sky));
}

.ci__thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 44%);
  pointer-events: none;
}

/* the line of light that reads the image */
.ci__scan {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 0;
  width: 2px;
  background: var(--accent);
  box-shadow: 0 0 6px 1px color-mix(in srgb, var(--accent) 80%, transparent), -8px 0 10px 2px color-mix(in srgb, var(--accent) 22%, transparent);
  opacity: 0;
}

/* ---------------------------------------------------------------- the words */
.ci__text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 4px;
  text-align: left;
}

.ci__labels {
  display: grid;
  min-width: 0;
}

.ci__label {
  grid-area: 1 / 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 15.5px;
  line-height: 1.15;
  font-weight: 580;
  font-variation-settings: 'wdth' 102;
  letter-spacing: 0.002em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}

.ci__label + .ci__label {
  opacity: 0;
}

.ci__meta {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 11.5px;
  line-height: 1.2;
  font-weight: 480;
  font-variation-settings: 'wdth' 94;
  letter-spacing: 0.015em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ci__weight {
  display: inline-block;
  min-width: 46px;
  color: rgba(243, 244, 241, 0.78);
}

.ci__bar {
  position: relative;
  flex: none;
  width: 40px;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.ci__bar-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(243, 244, 241, 0.7), rgba(243, 244, 241, 0.45));
  transform-origin: 0 50%;
}

.ci__bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent);
  box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 70%, transparent);
  opacity: var(--ok, 0);
}

.ci__note {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------- the knob */
.ci__knob {
  flex: none;
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}

.ci__well {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, #ffffff, var(--knob) 46%, color-mix(in srgb, var(--knob) 84%, #4d5a52) 100%);
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.6),
    0 4px 10px -4px rgba(0, 0, 0, 0.9),
    inset 0 -1px 1px rgba(60, 80, 70, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

/* the mint the knob turns at the end, a layer under the icon */
.ci__well::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 90% at 50% 0%, #e9fff4, var(--accent) 55%, color-mix(in srgb, var(--accent) 70%, #0d3b2a) 100%);
  opacity: var(--mint, 0);
}

.ci__icon {
  position: relative;
  width: 18px;
  height: 18px;
  overflow: visible;
}

.ci__icon path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ci__chev {
  stroke: var(--knob-ink);
  stroke-width: 1.9;
}

.ci__check {
  stroke: var(--success);
  stroke-width: 2.3;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
}
