/* The AI model selector with the liquid metal light: the model picker of Quill Studio, an AI writing app, on a dark
   studio page with a cold light and a fine grain. Three glass cards side by side; the chosen one wears a rim of liquid
   metal (two conic gradients turning against each other, blended) that pours from card to card on two springs. GSAP
   moves only .card__tilt and the rim; the CSS draws the rest. */
:root {
  --page: #07080b;           /* the page */
  --page-light: #18202c;     /* the cold light behind the picker */
  --panel: rgba(255, 255, 255, 0.025); /* the panel that holds the cards */
  --glass: rgba(255, 255, 255, 0.045); /* the glass of a card */
  --edge: rgba(255, 255, 255, 0.075);  /* the hairline edge of the glass */
  --ink: #eef1f5;            /* the words */
  --muted: #7d8592;          /* the small words */
  --dim: #545b66;            /* the words of the cards not chosen */
  --tick: rgba(255, 255, 255, 0.12);   /* the empty ticks of the chart */
  --accent: #a9d4ff;         /* the colour the metal throws on the chosen card */
  --metal-dark: #1b1f25;     /* the dark of the liquid metal */
  --metal-mid: #6f7a88;      /* the middle of the liquid metal */
  --metal-light: #f6f9fc;    /* 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: 16px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(60% 46% at 50% 30%, var(--page-light), transparent 70%),
    radial-gradient(40% 30% at 22% 72%, rgba(120, 150, 210, 0.07), transparent 70%),
    radial-gradient(36% 28% at 80% 70%, rgba(190, 170, 230, 0.05), transparent 70%),
    var(--page);
}

/* a soft floor under the picker */
.stage::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(760px, 110vw);
  height: min(220px, 30vh);
  transform: translate(-50%, 40%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(170, 200, 240, 0.07), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

.stage__grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.09;
  mix-blend-mode: overlay;
  background-size: 160px 160px;
  z-index: 3;
}

.picker {
  position: relative;
  width: min(660px, 92vw, 100%);
  padding: clamp(12px, 3vw, 22px) clamp(10px, 2.6vw, 22px) clamp(12px, 2.6vh, 18px);
  border-radius: clamp(18px, 3.4vw, 26px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), var(--panel) 40%, rgba(255, 255, 255, 0.012));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 40px 80px -40px rgba(0, 0, 0, 0.95),
    0 12px 30px -18px rgba(0, 0, 0, 0.8);
  opacity: 0;
}

.picker__head,
.picker__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.picker__title,
.picker__meta,
.picker__status,
.picker__hint {
  margin: 0;
  white-space: nowrap;
}

.picker__title {
  font-size: clamp(13px, 2.2vw, 15px);
  font-weight: 600;
  font-variation-settings: 'wdth' 106;
  letter-spacing: 0.005em;
}

.picker__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  padding: 4px 9px 4px 7px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.picker__meta svg {
  width: 11px;
  height: 11px;
  fill: var(--accent);
  opacity: 0.85;
}

.picker__row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 1.6vw, 14px);
  margin: clamp(10px, 2.4vh, 18px) 0 clamp(10px, 2.2vh, 16px);
}

.picker__foot {
  font-size: 11.5px;
}

.picker__status {
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
}

.picker__hint {
  color: var(--muted);
}

/* ---------------------------------------------------------------- the cards */
.card {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--r, 16px);
  -webkit-tap-highlight-color: transparent;
  outline: none;
  --r: clamp(12px, 2.4vw, 18px);
}

.card__tilt {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: clamp(10px, 2.2vw, 18px) clamp(9px, 2vw, 16px) clamp(10px, 2vw, 16px);
  border-radius: var(--r);
  will-change: transform;
}

.card__glass {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.075), var(--glass) 38%, rgba(255, 255, 255, 0.015));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 0 0 1px var(--edge),
    0 22px 40px -24px rgba(0, 0, 0, 0.9);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  z-index: -1;
}

/* the reflection under the pointer */
.card__shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(120px 90px at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, 0.12), transparent 70%),
    linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.05) 46%, transparent 58%);
  opacity: var(--h, 0);
  pointer-events: none;
}

.card:focus-visible .card__glass {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 0 0 1px var(--edge),
    0 0 0 2px var(--page),
    0 0 0 3.5px var(--accent);
}

.card__top {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.card__icon {
  flex: none;
  width: clamp(14px, 2.4vw, 18px);
  height: clamp(14px, 2.4vw, 18px);
  fill: none;
  stroke: var(--dim);
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.4s;
}

.card__name {
  font-size: clamp(12.5px, 2.5vw, 17px);
  font-weight: 600;
  font-variation-settings: 'wdth' 100;
  letter-spacing: -0.005em;
  color: var(--muted);
  transition: color 0.4s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card__line {
  margin-top: 4px;
  font-size: clamp(9.5px, 1.8vw, 12px);
  line-height: 1.35;
  color: var(--dim);
  min-height: 2.7em;
}

.chart {
  display: grid;
  gap: clamp(5px, 1vh, 8px);
  margin: clamp(8px, 2vh, 16px) 0 clamp(8px, 1.6vh, 12px);
}

.chart__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.chart__label {
  font-size: clamp(8.5px, 1.5vw, 10px);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
}

.chart__ticks {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: clamp(8px, 1.6vh, 12px);
}

.tick {
  flex: none;
  width: 1.5px;
  height: 100%;
  border-radius: 1px;
  background: var(--tick);
  transform-origin: 50% 100%;
}

.tick.is-on {
  background: rgba(255, 255, 255, 0.34);
}

.card[aria-checked='true'] .tick.is-on {
  background: var(--accent);
  box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 40%, transparent);
}

.card__stat,
.card__price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
  min-width: 0;
}

.card__stat {
  font-size: clamp(10px, 1.8vw, 12px);
  color: var(--dim);
}

.card__rule {
  display: block;
  height: 1px;
  margin: clamp(7px, 1.6vh, 12px) 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
}

.card__price {
  margin-top: auto;
  flex-wrap: wrap;
  row-gap: 0;
}

.card__unit {
  font-size: clamp(8.5px, 1.6vw, 11px);
  color: var(--dim);
}

.num {
  display: inline-flex;
  align-items: flex-start;
  line-height: 1.15em;
  font-variant-numeric: tabular-nums;
  font-weight: 560;
  color: var(--muted);
  transition: color 0.4s;
}

.num--big {
  font-size: clamp(15px, 3.4vw, 24px);
  font-weight: 620;
  font-variation-settings: 'wdth' 94;
  letter-spacing: -0.02em;
}

.card[aria-checked='true'] .card__name,
.card[aria-checked='true'] .num {
  color: var(--ink);
}

.card[aria-checked='true'] .card__icon {
  stroke: var(--accent);
}

.card[aria-checked='true'] .card__line,
.card[aria-checked='true'] .card__unit,
.card[aria-checked='true'] .chart__label,
.card[aria-checked='true'] .card__stat {
  color: var(--muted);
}

/* the digit drums: every piece of a number is one line box, so dots and drums share the same baseline */
.num > span {
  display: inline-block;
  height: 1.15em;
  line-height: 1.15em;
  vertical-align: top;
}

.drum {
  display: inline-block;
  height: 1.15em;
  line-height: 1.15em;
  overflow: hidden;
}

.drum__col {
  display: block;
}

.drum__col > span {
  display: block;
  height: 1.15em;
  text-align: center;
}

/* ---------------------------------------------------------------- the liquid metal rim */
.rim {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
}

.rim__metal {
  position: absolute;
  inset: 0;
  border-radius: var(--rr, 16px);
  padding: 1.8px;
  background:
    conic-gradient(from var(--a1, 0deg), var(--metal-dark) 0%, var(--metal-mid) 5%, var(--metal-light) 8%, var(--metal-mid) 11%, var(--metal-dark) 19%, var(--metal-dark) 30%, var(--metal-mid) 40%, #d9e2ec 44%, var(--metal-dark) 52%, var(--metal-dark) 66%, var(--metal-mid) 72%, var(--metal-light) 75%, var(--metal-mid) 78%, var(--metal-dark) 86%, var(--metal-dark) 100%),
    conic-gradient(from var(--a2, 0deg), var(--metal-dark) 0%, var(--metal-dark) 22%, var(--accent) 28%, #ffffff 31%, var(--accent) 34%, var(--metal-dark) 42%, var(--metal-dark) 70%, var(--metal-mid) 76%, #ffffff 79%, var(--metal-dark) 85%, var(--metal-dark) 100%);
  background-blend-mode: lighten;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.rim__glow {
  position: absolute;
  inset: -3px;
  filter: blur(8px);
  opacity: 0.8;
}

.rim__glow .rim__metal {
  padding: 4px;
  border-radius: calc(var(--rr, 16px) + 3px);
}

/* the light the metal throws inside the chosen card */
.rim__sheen {
  position: absolute;
  inset: 1.6px;
  border-radius: calc(var(--rr, 16px) - 1.6px);
  background:
    radial-gradient(90% 50% at var(--sx, 50%) 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(70% 40% at calc(100% - var(--sx, 50%)) 100%, rgba(255, 255, 255, 0.05), transparent 70%);
}

/* ---------------------------------------------------------------- the drawn pointer */
.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: var(--cursor);
  stroke: #0b0d11;
  stroke-width: 1.2;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6));
  pointer-events: none;
  z-index: 4;
  opacity: 0;
}

@media (max-width: 420px) {
  .picker__hint {
    display: none;
  }
}
