/* The assistant voice selector with the liquid metal wave: the voice picker of Vela, an AI assistant, alone on black.
   A panel of dark glass holds a wave drawn on a canvas (chrome that takes the timbre of the chosen voice), the line
   the voice says, a row of four pills with a metal thumb on a spring, and a Preview button. GSAP moves the thumb
   wrapper, the play body and the words; the CSS draws the rest. */
:root {
  --page: #000000;           /* the page */
  --panel-top: #121317;      /* the top of the glass panel */
  --panel-bottom: #08090b;   /* the bottom of the glass panel */
  --edge: rgba(255, 255, 255, 0.08);  /* the hairline edge of the panel */
  --ink: #eef0f4;            /* the words */
  --muted: #7b808b;          /* the small words */
  --dim: #4b505a;            /* the words not lit yet */
  --accent: #b9a8ff;         /* the one accent: the lilac the metal throws */
  --metal-dark: #23262d;     /* the dark of the liquid metal */
  --metal-mid: #8a919d;      /* the middle of the liquid metal */
  --metal-light: #f7f8fb;    /* the highlights of the liquid metal */
  --cursor: #f4f6f9;         /* the drawn pointer */
}

* {
  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: 12px;
  overflow: hidden;
}

/* ------------------------------------------------------------------ the panel */
.voice {
  position: relative;
  width: min(400px, 100%);
  padding: clamp(14px, 3.4vh, 20px) clamp(14px, 4vw, 20px) clamp(12px, 3vh, 18px);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 0 0 1px var(--edge),
    0 40px 80px -36px rgba(0, 0, 0, 1),
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 30px 90px -50px rgba(185, 168, 255, 0.28);
  opacity: 0;
  isolation: isolate;
}

/* a cold light falling into the glass from the top, brighter while the voice speaks */
.voice__glass {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(70% 50% at 50% 0%, rgba(185, 168, 255, calc(0.06 + var(--talk, 0) * 0.08)), transparent 70%),
    radial-gradient(50% 40% at 50% 46%, rgba(255, 255, 255, calc(0.015 + var(--talk, 0) * 0.03)), transparent 70%);
  z-index: -1;
}

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

.voice__titles {
  display: grid;
  gap: 3px;
}

.voice__title,
.voice__meta,
.voice__desc,
.voice__hz,
.voice__line {
  margin: 0;
}

.voice__title {
  font-size: 15px;
  font-weight: 620;
  font-variation-settings: 'wdth' 108;
  letter-spacing: 0.004em;
}

.voice__meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.voice__meta svg {
  width: 10px;
  height: 10px;
  fill: var(--accent);
}

/* ------------------------------------------------------------------ the preview button */
.play {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  -webkit-tap-highlight-color: transparent;
}

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

.play__body {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px 0 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.035));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 6px 16px -8px rgba(0, 0, 0, 0.9);
  transition: background-color 0.3s;
}

.play__icon {
  position: relative;
  width: 24px;
  height: 24px;
  flex: none;
}

.play__icon svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.play__ring {
  transform: rotate(-90deg);
}

.play__track {
  fill: rgba(255, 255, 255, 0.06);
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 1;
}

.play__arc {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-dasharray: 64.4;
  stroke-dashoffset: 64.4;
}

.play__tri {
  fill: var(--ink);
}

.play__bars {
  fill: var(--accent);
  opacity: 0;
}

.play__bars rect {
  transform-box: fill-box;
  transform-origin: center;
}

.play__label {
  font-size: 12.5px;
  font-weight: 560;
  font-variation-settings: 'wdth' 104;
  min-width: 58px;
  white-space: nowrap;
}

@media (hover: hover) {
  .play:hover .play__body {
    background-color: rgba(255, 255, 255, 0.04);
  }
}

/* ------------------------------------------------------------------ the wave */
.wave {
  position: relative;
  height: clamp(64px, 19vh, 112px);
  margin: clamp(10px, 2.6vh, 18px) -4px 0;
}

.wave__canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.voice__line {
  min-height: 1.4em;
  margin-top: clamp(6px, 1.6vh, 10px);
  text-align: center;
  font-size: 13px;
  font-weight: 460;
  font-variation-settings: 'wdth' 100;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice__line .w {
  display: inline-block;
  will-change: opacity, transform;
}

/* ------------------------------------------------------------------ the pills */
.pills {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  margin-top: clamp(10px, 2.6vh, 16px);
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.8),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 1px 0 rgba(255, 255, 255, 0.05);
}

.pills__thumb {
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 80px;
  border-radius: 999px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.04) 46%, rgba(255, 255, 255, 0.1)),
    linear-gradient(90deg, #2c2f37, #3b3f49 50%, #2c2f37);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 4px 10px -4px rgba(0, 0, 0, 0.9),
    0 0 18px -6px rgba(185, 168, 255, 0.45);
  pointer-events: none;
  will-change: transform, width;
}

/* a sliver of light that crosses the thumb while the voice speaks */
.pills__sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.28) 48%, rgba(185, 168, 255, 0.3) 52%, transparent 70%);
  background-size: 260% 100%;
  background-position: var(--sx, 120%) 0;
  mix-blend-mode: screen;
}

.pill {
  position: relative;
  appearance: none;
  border: 0;
  background: none;
  height: 38px;
  padding: 0 4px;
  border-radius: 999px;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 540;
  font-variation-settings: 'wdth' var(--wd, 100);
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.35s;
  z-index: 1;
}

.pill[aria-checked='true'] {
  color: var(--ink);
}

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

@media (hover: hover) {
  .pill[aria-checked='false']:hover {
    color: #b9bdc6;
  }
}

.voice__foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-top: clamp(8px, 2vh, 12px);
  padding: 0 6px;
}

.voice__desc,
.voice__hz {
  font-size: 11.5px;
  font-weight: 480;
  color: var(--muted);
  white-space: nowrap;
}

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

.voice__hz {
  font-variant-numeric: tabular-nums;
  color: var(--dim);
}

/* ------------------------------------------------------------------ the drawn pointer */
.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: var(--cursor);
  stroke: #000;
  stroke-width: 1;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.6));
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}

@media (max-width: 380px) {
  .pill {
    font-size: 12px;
  }
  .voice__desc {
    font-size: 11px;
  }
}
