
/* Vy drawer — the one Vy surface (SON-4012). Inlined by tools/build-vy-drawer.py; edit here.

   TOKENS ONLY, NO FALLBACKS. The site is a dark theme (--bg #080A0C, --text #F4F5F2, --mineral a
   light cream). An earlier version invented token names with LIGHT fallbacks and produced dark-on-
   dark bubbles and a white composer. A fallback that is wrong for the only theme the site has hides
   breakage behind a plausible value; if a token is missing the page is already broken, let it show.

   This is a Sonsoto surface built from Sonsoto tokens. It deliberately borrows no geometry, colour,
   wording or iconography from any third-party assistant UI. */

.vyd-scrim {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, .5);
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease;
}
.vyd-scrim[data-open] { opacity: 1; pointer-events: auto; }

.vyd {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 201;
  width: min(440px, 100vw);
  display: flex; flex-direction: column; min-height: 0;
  background: var(--bg-2);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform .22s ease;
  /* The drawer is its own scroll context: the page behind it must not move when the thread does. */
  overscroll-behavior: contain;
}
.vyd[data-open] { transform: none; }
.vyd[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  .vyd, .vyd-scrim { transition: none; }
}

/* Type scale (2026-09-15 visual refinement, owner brief: mobile-first, calmer, more premium):
   title 17 · subtitle 13.5 · context line 13 · intro 15 · message + input 16 (line-height 1.5) · chips 14.5 · status 13.
   Every value is a token or a plain px on this scale; nothing sits below 13px. */

/* Header ------------------------------------------------------------------ */
.vyd-head {
  flex: none;
  display: flex; align-items: flex-start; gap: 14px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.vyd-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; padding-top: 2px; }
.vyd-name { font-size: 17px; font-weight: 600; letter-spacing: -.01em; color: var(--text); line-height: 1.25; }
.vyd-role { font-size: 13.5px; color: var(--muted); line-height: 1.4; }
/* The page the visitor came from, so the conversation is visibly about something. */
.vyd-ctx {
  margin-top: 6px; font-size: 13px; color: var(--faint); line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vyd-x {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; padding: 0; margin: -6px -8px 0 0;
  border: 0; border-radius: 10px; cursor: pointer;
  background: none; color: var(--muted);
}
.vyd-x svg { width: 18px; height: 18px; }
.vyd-x:hover { color: var(--text); background: var(--control-surface); }
.vyd-x:focus-visible, .vyd-chip:focus-visible, .vyd-send:focus-visible, .vyd-retry:focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: 2px;
}

/* Thread ------------------------------------------------------------------ */
.vyd-log {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 20px 22px;
}
/* The intro is supporting copy: one step below the messages, in the muted ink. */
.vyd-welcome { font-size: 15px; line-height: 1.55; color: var(--muted); margin: 0; max-width: 40ch; }
.vyd-suggest { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; }
.vyd-chip {
  text-align: left; width: 100%;
  padding: 12px 14px;
  font: inherit; font-size: 14.5px; line-height: 1.4;
  color: var(--text);
  background: var(--control-surface);
  border: 1px solid var(--line); border-radius: 12px;
  cursor: pointer;
}
.vyd-chip:hover { border-color: var(--line-strong); }

.vyd-turn { display: flex; }
.vyd-turn + .vyd-turn { margin-top: 2px; }
.vyd-turn[data-role="user"] { justify-content: flex-end; }
.vyd-bubble {
  max-width: 92%;
  padding: 12px 16px; border-radius: 16px;
  font-size: 16px; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
/* Vy's turn: a quiet card one step lighter than the drawer, no shadow, a short tail. */
.vyd-turn[data-role="assistant"] .vyd-bubble {
  background: var(--surface-2); border: 1px solid var(--line-soft);
  color: var(--text); border-bottom-left-radius: 5px;
}
/* The visitor's turn carries the page's primary voice (the .btn-primary pairing): the mineral tone with the page
   ground as its ink, so it inverts correctly in both themes — cream with dark ink on the dark theme, the olive with
   light ink on the light theme (the light theme used to set dark ink on the olive: muddy and under contrast). */
.vyd-turn[data-role="user"] .vyd-bubble {
  max-width: 84%;
  background: var(--mineral); color: var(--bg); border-bottom-right-radius: 5px;
}
:root[data-theme="light"] .vyd-turn[data-role="user"] .vyd-bubble { background: var(--mineral-hi); }
/* A failure is a statement about the request, not a message from Vy — it must not look like one. */
.vyd-turn[data-error] .vyd-bubble {
  max-width: 100%; background: transparent;
  border: 1px solid var(--line-strong); color: var(--muted); border-radius: 12px; font-size: 15px;
}
.vyd-retry {
  margin-top: 8px; display: block;
  font: inherit; font-size: 14px; font-weight: 600;
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--text); text-decoration: underline; text-underline-offset: 3px;
}
.vyd-bubble[data-streaming]::after {
  content: ""; display: inline-block;
  width: 6px; height: .95em; margin-left: 2px; vertical-align: -2px;
  background: currentColor; opacity: .45;
  animation: vyd-blink 1s steps(2, start) infinite;
}
@keyframes vyd-blink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .vyd-bubble[data-streaming]::after { animation: none; } }

/* Composer ---------------------------------------------------------------- */
.vyd-foot {
  flex: none;
  padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-soft);
  background: var(--bg-2);
}
.vyd-form { display: flex; align-items: flex-end; gap: 10px; }
.vyd-in {
  flex: 1; min-width: 0; resize: none; max-height: 132px; min-height: 48px;
  font: inherit; font-size: 16px; line-height: 1.45;
  padding: 12px 16px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--control-surface); color: var(--text);
  overflow-y: hidden;   /* the script lifts this once the field reaches its ceiling */
}
/* The placeholder is built from the page title and can run long: one line, cut with an ellipsis, never a wrapped
   second line hiding under the field's edge. */
.vyd-in::placeholder { color: var(--muted); opacity: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vyd-in:focus { outline: none; border-color: var(--line-strong); }
.vyd-in:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }   /* the site's focus ring token; --mineral-30 exists only in the light theme */
.vyd-send {
  flex: none; display: grid; place-items: center;
  width: 48px; height: 48px; padding: 0;
  border: 0; border-radius: 14px; cursor: pointer;
  background: var(--mineral); color: var(--bg);
}
.vyd-send svg { width: 20px; height: 20px; }
.vyd-send:disabled { opacity: .4; cursor: default; }
.vyd-status { margin: 8px 0 0; font-size: 13px; line-height: 1.4; color: var(--muted); min-height: 1.4em; }
.vyd-status[data-over] { color: var(--mineral-hi); font-weight: 600; }

/* Phone — a near-full-height sheet. The composer must clear the virtual keyboard, so the drawer is
   sized against the small viewport unit where it is supported (100vh is the WRONG unit here: it
   measures the viewport WITHOUT the keyboard and pushes the composer under it). */
@media (max-width: 640px) {
  .vyd {
    width: 100vw; top: auto; height: 92vh; border-left: 0;
    border-top: 1px solid var(--line); border-radius: 18px 18px 0 0;
    transform: translateY(100%);
  }
  .vyd[data-open] { transform: none; }
}
@supports (height: 100svh) {
  @media (max-width: 640px) { .vyd { height: 92svh; } }
}

/* Guided fallback card (owner brief, 2026-09-16) — a failed turn is an advisory next step, not a system error ---- */
.vyd-turn[data-error] .vyd-bubble { border: 1px solid var(--line); background: var(--surface-tinted); }
.vyd-fail-lead { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.vyd-fail-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.vyd-fail-acts .vyd-retry, .vyd-fail-act {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1; text-decoration: none; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--control-surface); color: var(--text);
}
.vyd-fail-acts .vyd-retry { background: var(--mineral); color: var(--bg); border-color: transparent; }
.vyd-fail-act:hover, .vyd-fail-acts .vyd-retry:hover { border-color: var(--text); }
.vyd-fail-act:focus-visible, .vyd-fail-acts .vyd-retry:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.vyd-suggest--after { margin-top: 16px; }
.vyd-suggest-lead { flex-basis: 100%; margin: 0 0 4px; font-size: 13px; color: var(--muted); }

/* Phone composer (owner brief, 2026-09-16): more room for the field, a lighter send control, nothing clipped ---- */
@media (max-width: 640px) {
  .vyd-foot { padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
  .vyd-form { gap: 8px; }
  .vyd-in { min-height: 44px; padding: 10px 14px; font-size: 16px; }
  .vyd-send { width: 44px; height: 44px; border-radius: 12px; }
  .vyd-send svg { width: 18px; height: 18px; }
  .vyd-status { font-size: 12.5px; }
}
    