:root {
  --fondo: #ffffff;
  --pagina: #ffffff;
  --bordo: #ececef;
  --riga: #f0f0f3;
  --riga-2: #e6e6ea;
  --inchiostro: #131316;     /* the launcher */
  --inchiostro-su: #24242a;
  --testo: #16161a;
  --testo-2: #5f5d68;
  --testo-3: #a3a1ab;
  --pannello: #ffffff;
  --bolla: #f4f4f6;
  --accento: #4b3df2;        /* the single accent: Wren’s violet, on the avatar and the chips on hover */
  --ombra: 20, 20, 32;
  --k: 3.25em;               /* the launcher circle */
  --gap: .85em;              /* the launcher’s distance from the corner */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { font-size: clamp(12px, min(3.4vw, 3vh), 16px); }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; background: none; border: 0; }
button { cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.stage { height: 100vh; display: grid; place-items: center; padding: 3vh 3vw; }

/* the corner of the site: a frame with a few thin grey lines, just enough to read the corner */
.site {
  position: relative;
  width: min(30em, 94vw);
  height: min(32em, 92vh);
  background: var(--pagina);
  border: 1px solid var(--bordo);
  border-radius: 1.1em;
  overflow: hidden;
}
.site__page { position: absolute; inset: 1.6em 1.6em auto; display: grid; gap: .7em; }
.line { display: block; height: .42em; border-radius: 1em; background: var(--riga); width: 72%; }
.line--logo { width: 3.2em; height: .62em; background: var(--riga-2); margin-bottom: 1.1em; }
.line--h { height: 1.1em; width: 78%; background: var(--riga-2); }
.line--h2 { height: 1.1em; width: 52%; background: var(--riga-2); margin-bottom: .6em; }
.line--s { width: 60%; }
.line--m { width: 66%; }

/* ---- the panel: drawn from the launcher’s own circle with a clip-path; the shadow lives on the parent
   (a drop-shadow on the parent follows the clipped shape, so it grows with the panel) ---- */
.shell {
  position: absolute; right: var(--gap); bottom: var(--gap);
  width: min(19.5em, calc(100% - 2 * var(--gap)));
  height: min(25em, calc(100% - 2 * var(--gap)));
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(var(--ombra), .06)) drop-shadow(0 18px 26px rgba(var(--ombra), .16));
}
.shell.is-open { pointer-events: auto; }
.panel {
  position: absolute; inset: 0;
  display: grid; grid-template-rows: auto 1fr auto;
  background: var(--pannello);
  border-radius: 1.25em;
  visibility: hidden;
  transform-origin: 100% 100%;
}
.panel__head {
  display: flex; align-items: center; gap: .7em;
  padding: 1em 1.1em .9em;
  border-bottom: 1px solid var(--bordo);
}
.avatar {
  flex: none;
  width: 2.1em; height: 2.1em; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accento);
}
.avatar svg { width: 1.15em; height: 1.15em; display: block; fill: #fff; }
.who { display: grid; line-height: 1.2; min-width: 0; }
.who strong { font-weight: 660; font-size: .95em; letter-spacing: -.01em; }
.who span { font-size: .74em; color: var(--testo-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.panel__body { padding: 1.05em 1.1em; display: grid; align-content: start; gap: .9em; overflow: hidden; }
.bubble {
  justify-self: start;
  max-width: 88%;
  padding: .7em .9em;
  border-radius: 1em 1em 1em .3em;
  background: var(--bolla);
  font-size: .9em; line-height: 1.42;
  color: var(--testo);
}
.bubble .w { display: inline-block; white-space: pre; will-change: transform, opacity; }
.chips { display: grid; justify-items: start; gap: .45em; }
.chip {
  padding: .5em .85em;
  border: 1px solid var(--bordo);
  border-radius: 2em;
  font-size: .8em; font-weight: 520;
  color: var(--testo-2);
  background: #fff;
  transition: border-color .25s, color .25s, background-color .25s;
}
.chip.is-on { border-color: color-mix(in srgb, var(--accento) 40%, #fff); color: var(--accento); background: color-mix(in srgb, var(--accento) 6%, #fff); }
@media (hover: hover) {
  .chip:hover { border-color: color-mix(in srgb, var(--accento) 40%, #fff); color: var(--accento); background: color-mix(in srgb, var(--accento) 6%, #fff); }
}

/* the input leaves the corner free: the launcher, now an X, sits there */
.panel__foot { padding: .73em calc(var(--k) + .45em) .73em .73em; border-top: 1px solid var(--bordo); }
.field { display: block; }
.field input {
  width: 100%; height: 2.1em;
  padding: 0 .85em;
  border-radius: 2em;
  background: var(--bolla);
  font-size: .85em;
  outline: none;
}
.field input::placeholder { color: var(--testo-3); }

/* ---- the launcher: the circle is a fixed cell, the «Ask Wren» tab grows behind it to the left,
   so the hidden label can never move the icon off the circle’s centre ---- */
.launcher {
  position: absolute; right: var(--gap); bottom: var(--gap);
  width: var(--k); height: var(--k);
  z-index: 3;
}
.tab {
  position: absolute; right: 0; top: 0;
  height: var(--k); width: var(--k);
  border-radius: calc(var(--k) / 2);
  background: var(--inchiostro);
  overflow: hidden;
  box-shadow: 0 10px 22px -12px rgba(var(--ombra), .55);
}
.tab__label {
  position: absolute; top: 0; bottom: 0; left: 1.2em;
  display: flex; align-items: center;
  color: #fff; font-size: .9em; font-weight: 600; letter-spacing: -.005em;
  white-space: nowrap;
  opacity: 0;
}
.knob {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--inchiostro);
  color: #fff;
  overflow: hidden;
}
.knob__shine {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(120% 90% at 30% 12%, rgba(255,255,255,.16), rgba(255,255,255,0) 55%);
  pointer-events: none;
}
.knob:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }
.icon { position: relative; width: 1.55em; height: 1.55em; display: block; overflow: visible; }
.icon__bubble { fill: none; stroke: #fff; stroke-width: 1.7; stroke-linejoin: round; }
.icon__dots { fill: none; stroke: #fff; stroke-width: 2.1; stroke-linecap: round; }
.icon__x { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }

@media (max-width: 520px) {
  /* on the phone the panel takes almost the whole box */
  :root { --gap: .7em; }
  .shell { width: calc(100% - 2 * var(--gap)); height: calc(100% - 2 * var(--gap)); }
}
