/* The voice search bar of a made-up clothing shop, Marlo, on warm white. One accent: the voice red of the mic, the
   waveform and the picked-up words. The bar, the pills and the cards are white with layered soft shadows. */
:root {
  --fondo: #f7f4ee;          /* the warm white page */
  --carta: #ffffff;          /* the bar, the pills, the cards */
  --bordo: rgba(40, 32, 22, 0.09);
  --testo: #1d1a16;          /* the spoken words once they are sure */
  --testo-2: #6f685e;        /* the small words */
  --testo-3: #b1a99c;        /* a word the voice is not sure of yet */
  --accento: #d9482b;        /* the voice: mic, waveform, picked-up words */
  --accento-tenue: #fbe9e3;  /* the soft red behind the listening bar */
  --lino-1: #ebe3d4;         /* the linen swatches of the results */
  --lino-2: #d8c6a8;
  --lino-3: #cdd0c2;
  --lino-4: #c2b9ad;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { touch-action: manipulation; }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul { list-style: none; }

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 3vh, 28px) 12px;
}

.app {
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---- the status line above the bar ---- */
.status {
  align-self: flex-start;
  margin: 0 0 clamp(6px, 1.4vh, 12px) clamp(4px, 1vw, 10px);
  font-size: 12.5px;
  font-weight: 460;
  letter-spacing: 0.005em;
  color: var(--testo-2);
  white-space: nowrap;
}
.status.is-listening {
  background: linear-gradient(90deg, var(--testo-2) 0%, var(--testo-2) 38%, var(--accento) 50%, var(--testo-2) 62%, var(--testo-2) 100%);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: luccica 1.8s linear infinite;
}
@keyframes luccica { from { background-position: 100% 0; } to { background-position: -60% 0; } }

/* ---- the bar ---- */
.bar {
  --open: 0;
  position: relative;
  width: calc(76% + 24% * var(--open));
  height: clamp(44px, 6.4vh + 12px, 56px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 0 16px;
  border-radius: 999px;
  background: var(--carta);
  box-shadow:
    inset 0 0 0 1px var(--bordo),
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 1px 2px rgba(40, 30, 18, 0.05),
    0 8px 22px -10px rgba(40, 30, 18, 0.18),
    0 22px 44px -26px rgba(40, 30, 18, 0.22);
  transition: box-shadow 0.45s ease;
}
.bar.is-on {
  box-shadow:
    inset 0 0 0 1px rgba(217, 72, 43, 0.28),
    0 0 0 4px rgba(217, 72, 43, 0.07),
    0 1px 2px rgba(40, 30, 18, 0.05),
    0 10px 26px -10px rgba(120, 40, 20, 0.2),
    0 26px 50px -26px rgba(120, 40, 20, 0.24);
}

.bar__lens {
  flex: none;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--testo-2);
}
.bar__lens svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

.bar__field {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.bar__ph {
  position: absolute;
  left: 0;
  top: 50%;
  translate: 0 -50%;
  font-size: 15.5px;
  color: var(--testo-3);
  white-space: nowrap;
  pointer-events: none;
}
.bar__line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.words {
  display: flex;
  align-items: baseline;
  gap: 0.3em;
  font-size: 15.5px;
  font-weight: 480;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.w {
  display: inline-grid;
  justify-items: start;
  will-change: filter, opacity;
}
.w > span { grid-area: 1 / 1; white-space: nowrap; }

/* the waveform: thin vertical lines, and the flat line they fold into */
.wave {
  position: relative;
  flex: none;
  width: clamp(44px, 14vw, 84px);
  height: 22px;
}
.wave__bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wave__bar {
  width: 1.5px;
  height: 100%;
  border-radius: 1px;
  background: var(--accento);
  transform: scaleY(0);
}
.wave__flat {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  margin-top: -0.5px;
  background: var(--accento);
  transform: scaleX(0);
}

/* the mic */
.mic {
  position: relative;
  flex: none;
  width: clamp(34px, 4.6vh + 10px, 44px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--testo);
}
.mic__bg {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #f1ede6;
  box-shadow: inset 0 0 0 1px rgba(40, 32, 22, 0.06);
  transition: transform 0.35s cubic-bezier(0.34, 1.6, 0.5, 1), background-color 0.3s ease, box-shadow 0.3s ease;
}
.mic__icon { position: relative; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; transition: color 0.3s ease; }
.mic.is-on { color: #fff; }
.mic.is-on .mic__bg {
  background: var(--accento);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 6px 14px -6px rgba(217, 72, 43, 0.7);
}
@media (hover: hover) {
  .mic:hover .mic__bg { transform: scale(1.07); }
  .mic:not(.is-on):hover .mic__bg { background: #ebe5dc; }
}
.mic:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }

/* ---- the filter pills ---- */
.chips {
  align-self: stretch;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  min-height: 30px;
  margin-top: clamp(10px, 1.8vh, 16px);
  padding: 0 clamp(2px, 1vw, 8px);
}
.chip {
  position: relative;
  flex: none;
  height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px 0 12px;
  border-radius: 999px;
  background: var(--carta);
  box-shadow: inset 0 0 0 1px var(--bordo), 0 1px 2px rgba(40, 30, 18, 0.05), 0 6px 14px -8px rgba(40, 30, 18, 0.2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: font-variation-settings 0.4s cubic-bezier(0.34, 1.6, 0.5, 1), box-shadow 0.3s ease;
}
.chip__t { position: relative; }
.chip__x {
  display: grid;
  place-items: center;
  width: 0;
  height: 16px;
  margin-left: 0;
  opacity: 0;
  border-radius: 50%;
  transition: width 0.4s cubic-bezier(0.34, 1.5, 0.5, 1), margin 0.4s cubic-bezier(0.34, 1.5, 0.5, 1), opacity 0.2s ease, background-color 0.2s ease;
}
.chip__x svg { width: 9px; height: 9px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.chip.is-hover { font-variation-settings: "wdth" 108; box-shadow: inset 0 0 0 1px rgba(40, 32, 22, 0.16), 0 1px 2px rgba(40, 30, 18, 0.05), 0 8px 16px -8px rgba(40, 30, 18, 0.26); }
.chip.is-hover .chip__x { width: 16px; margin-left: 6px; opacity: 1; background: #f1ede6; }
@media (hover: hover) {
  .chip:hover { font-variation-settings: "wdth" 108; box-shadow: inset 0 0 0 1px rgba(40, 32, 22, 0.16), 0 1px 2px rgba(40, 30, 18, 0.05), 0 8px 16px -8px rgba(40, 30, 18, 0.26); }
  .chip:hover .chip__x { width: 16px; margin-left: 6px; opacity: 1; background: #f1ede6; }
  .chip .chip__x:hover { background: #e6dfd4; }
}
@media (hover: none) {
  .chip .chip__x { width: 16px; margin-left: 6px; opacity: 1; background: #f1ede6; }
}

/* ---- the results ---- */
.results {
  align-self: stretch;
  margin-top: clamp(12px, 2.4vh, 22px);
  padding: 0 clamp(2px, 1vw, 8px);
}
.results__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: clamp(6px, 1.2vh, 10px);
  font-size: 12px;
  color: var(--testo-2);
  font-variant-numeric: tabular-nums;
}
.results__count span { display: inline-block; color: var(--testo); font-weight: 560; }
.results__sort { display: inline-flex; align-items: center; gap: 3px; }
.results__sort svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1.6vw, 14px);
}
.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 6px 6px 9px;
  border-radius: 14px;
  background: var(--carta);
  box-shadow: inset 0 0 0 1px var(--bordo), 0 1px 2px rgba(40, 30, 18, 0.04), 0 10px 22px -14px rgba(40, 30, 18, 0.22);
}
.card.is-out { display: none; }
.card__tile {
  position: relative;
  height: clamp(58px, 15vh, 124px);
  border-radius: 9px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgba(60, 40, 20, 0.05) 0 1px, transparent 1px 3px),
    linear-gradient(160deg, rgba(255, 255, 255, 0.35), transparent 55%),
    var(--tile);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.card__tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(40, 30, 18, 0.06), inset 0 -18px 24px -18px rgba(40, 30, 18, 0.18);
}
.card__tile svg { width: 56%; height: 70%; fill: rgba(255, 255, 255, 0.22); stroke: rgba(40, 30, 18, 0.32); stroke-width: 1.1; stroke-linejoin: round; stroke-linecap: round; }
.card__name {
  margin-top: 7px;
  padding: 0 3px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 2px;
  padding: 0 3px;
  font-size: 11.5px;
  color: var(--testo-2);
}
.card__price { color: var(--testo); font-weight: 600; }
@media (hover: hover) {
  .card { transition: box-shadow 0.3s ease; }
  .card:hover { box-shadow: inset 0 0 0 1px rgba(40, 32, 22, 0.14), 0 1px 2px rgba(40, 30, 18, 0.04), 0 16px 28px -14px rgba(40, 30, 18, 0.3); }
}

@media (max-width: 380px) {
  .chip { padding: 0 9px 0 10px; font-size: 12.5px; }
  .card__meta .card__fab { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .status.is-listening { animation: none; color: var(--accento); background: none; }
  .chip, .chip__x, .mic__bg { transition-property: opacity, background-color, box-shadow; }
}
