/* The glass prompt field with suggestions that take turns: the prompt field of a made-up AI workspace on a near black
   page with a fine grain. The field is a stack of layers: the dark glass, a faint sheen under the pointer, the one
   pixel edge (a ring cut out with a mask) that catches the light from above and from the pointer, a beam that runs
   round the edge while the answer loads, and on top the text, the suggestions and the tool bar. Under it, a soft glow
   in two colours that grows while Vela thinks. */
:root {
  --page: #08080a;            /* the page */
  --page-light: #15142a;      /* the faint light on the page behind the field */
  --glass: rgba(26, 26, 33, 0.78); /* the glass of the field, top */
  --glass-low: rgba(14, 14, 19, 0.88); /* the glass of the field, bottom */
  --ink: #f2f2f5;             /* the words you write */
  --hint: #74747f;            /* the suggestions waiting */
  --hint-hover: #b4b4c0;      /* the suggestion under the pointer */
  --muted: #8b8b96;           /* the small words of the bar */
  --line: rgba(255, 255, 255, 0.08); /* the thin lines */
  --accent: #8d86ff;          /* the light: indigo */
  --accent-2: #4fd1ff;        /* the second light: cyan */
  --send: #f4f4f6;            /* the send button, ready */
  --send-ink: #0b0b0e;        /* the arrow on it */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

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

body {
  min-height: 100svh;
  background:
    radial-gradient(70% 55% at 50% 62%, var(--page-light), transparent 70%),
    var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* the grain over everything, drawn by an SVG noise */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  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%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.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;
}

.wrap {
  position: relative;
  width: min(92vw, 560px);
  opacity: 0;
}

/* the glow under the field, two soft lights */
.glow {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -26%;
  height: 78%;
  pointer-events: none;
  opacity: 0.5;
  filter: blur(min(34px, 6vw));
}

.glow__a,
.glow__b {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 50%;
}

.glow__a {
  left: 0;
  width: 62%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 95%, transparent), transparent);
}

.glow__b {
  right: 0;
  width: 54%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent-2) 75%, transparent), transparent);
}

.field {
  --mx: 50%;
  --my: 0%;
  --lit: 0.32;
  --a: 0;
  position: relative;
  margin: 0;
  border-radius: 22px;
  padding: clamp(16px, 3.4vh, 22px) clamp(14px, 4vw, 20px) clamp(10px, 2vh, 12px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.03),
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 14px 28px -10px rgba(0, 0, 0, 0.7),
    0 40px 80px -30px rgba(0, 0, 0, 0.9);
}

.field__glass,
.field__sheen,
.field__edge,
.field__beam {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.field__glass {
  background:
    radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%),
    radial-gradient(90% 80% at 100% 100%, color-mix(in srgb, var(--accent-2) 5%, transparent), transparent 60%),
    linear-gradient(180deg, var(--glass), var(--glass-low));
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 -14px 30px -18px rgba(0, 0, 0, 0.6);
}

/* the sheen: a very faint light inside the glass, under the pointer */
.field__sheen {
  background: radial-gradient(260px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.045), transparent 70%);
}

/* the edge: one pixel ring cut out with a mask; light from above and from the pointer */
.field__edge,
.field__beam {
  padding: 1px;
  -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 exclude, linear-gradient(#000 0 0);
}

.field__edge {
  background:
    radial-gradient(180px circle at var(--mx) var(--my), rgba(255, 255, 255, var(--lit)), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.06) 38%, rgba(255, 255, 255, 0.04) 70%, rgba(255, 255, 255, 0.1));
}

/* the beam that runs round the edge while the answer loads */
.field__beam {
  opacity: 0;
  background: conic-gradient(from calc(var(--a) * 1deg),
      transparent 0 62%,
      color-mix(in srgb, var(--accent) 60%, transparent) 78%,
      #ffffff 86%,
      var(--accent-2) 91%,
      transparent 97%);
}

.field__area {
  position: relative;
  z-index: 2;
}

.field__input {
  display: block;
  width: 100%;
  height: calc(2 * 1.42em);
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: var(--ink);
  caret-color: var(--accent);
  font: inherit;
  font-size: clamp(15px, 1.2vw + 10px, 17px);
  line-height: 1.42;
  font-weight: 430;
  letter-spacing: -0.005em;
}

/* the suggestions, laid exactly where the text will be */
.hint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: clamp(15px, 1.2vw + 10px, 17px);
  line-height: 1.42;
  font-weight: 430;
  letter-spacing: -0.005em;
}

.hint__btn {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  color: var(--hint);
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}

.hint.is-live .hint__btn {
  cursor: pointer;
}

.hint__line {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  pointer-events: none;
  transition: color 0.3s ease;
}

.hint.is-live .hint__line.is-now {
  pointer-events: auto;
}

.hint__line .w {
  display: inline-block;
  color: var(--c, inherit);
  white-space: pre;
}

/* the sent words, with a light that crosses them */
.hint__line.is-shine .w {
  color: transparent;
  background-image:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), transparent),
    linear-gradient(var(--ink-dim, #9a9aa6), var(--ink-dim, #9a9aa6));
  background-size: 120px 100%, 100% 100%;
  background-repeat: no-repeat;
  background-position: calc(var(--ox, 0px) + var(--sx, -200px)) 0, 0 0;
  -webkit-background-clip: text;
  background-clip: text;
}

.bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: clamp(12px, 3.4vh, 26px);
}

.bar__left,
.bar__right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.tool,
.model {
  appearance: none;
  border: 0;
  margin: 0;
  font: inherit;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.tool {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.tool svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.model {
  height: 32px;
  border-radius: 999px;
  padding: 0 10px 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  font-variation-settings: 'wdth' 104;
  white-space: nowrap;
}

.model__star {
  width: 13px;
  height: 13px;
  fill: var(--accent);
}

.model__chev {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.7;
}

@media (hover: hover) {
  .tool:hover,
  .model:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.06);
  }

  .hint.is-live .hint__line.is-now:hover {
    color: var(--hint-hover);
  }
}

.tool:focus-visible,
.model:focus-visible,
.send:focus-visible,
.hint__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* "Tab to use" with the ring that counts the time of the suggestion */
.use {
  position: relative;
  height: 22px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.use__swap {
  display: grid;
}

.use__idle,
.use__busy {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  height: 22px;
}

.use__busy {
  opacity: 0;
  color: transparent;
  background: linear-gradient(90deg, var(--muted) 0 35%, #ffffff 50%, var(--muted) 65% 100%) var(--bx, 100%) 0 / 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  font-weight: 500;
}

.key {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 22px;
}

.key__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
}

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

.key__fill {
  stroke: var(--accent);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.key__cap {
  position: relative;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variation-settings: 'wdth' 110;
  color: #a6a6b2;
}

.send {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  flex: none;
  -webkit-tap-highlight-color: transparent;
}

.send:disabled {
  cursor: default;
}

.send__face {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #6c6c77;
}

.send__icon {
  width: 16px;
  height: 16px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.send__spin {
  stroke-dasharray: 0.34 1;
  stroke-width: 1.9;
  opacity: 0;
  transform-origin: 8px 8px;
}

.send__check {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

@media (max-width: 400px) {
  .use__word {
    display: none;
  }

  .model {
    padding: 0 9px 0 8px;
  }
}
