File size: 17,708 Bytes
89565fe | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | @import 'tailwindcss';
@source '.';
/* stories may use classes the app does not, so tailwind scans them too */
@source '../tests/stories';
@plugin '@tailwindcss/forms';
@plugin '@tailwindcss/typography';
@import 'tw-animate-css';
@import './lib/styles/safe-area.css';
@custom-variant dark (&:is(.dark *));
/* shadcn components key their orientation styles off these, toggle-group among them */
@custom-variant data-horizontal (&[data-orientation='horizontal']);
@custom-variant data-vertical (&[data-orientation='vertical']);
/*
* Tailwind v4 dropped the pointer cursor from buttons. Every control a user can
* press gets it back, and anything disabled keeps the cursor its own class asks for.
*/
@layer base {
button:not(:disabled),
[role='button']:not([data-disabled]),
[role='checkbox']:not([data-disabled]),
[role='combobox']:not([data-disabled]),
[role='menuitem']:not([data-disabled]),
[role='menuitemcheckbox']:not([data-disabled]),
[role='menuitemradio']:not([data-disabled]),
[role='option']:not([data-disabled]),
[role='radio']:not([data-disabled]),
[role='switch']:not([data-disabled]),
[role='tab']:not([data-disabled]),
label[for],
select,
summary {
cursor: pointer;
}
}
:root {
--radius: 0.625rem;
/* the page runs under the status bar and over the home indicator
(viewport-fit=cover); what is pinned to a screen edge keeps clear of them
with the pt-safe / pb-safe utilities (see lib/styles/safe-area.css) */
--safe-area-top: env(safe-area-inset-top, 0px);
--safe-area-bottom: env(safe-area-inset-bottom, 0px);
/* where the phone's corner controls (menu toggle, context gauge, sidebar logo) sit */
--corner-control-top: calc(1rem + var(--safe-area-top));
/* where a phone page's title starts: a row below the corner controls */
--page-top: calc(var(--corner-control-top) + 3.75rem);
/* expanded desktop sidebar width, overridden once the user drags its edge */
--sidebar-width: 18rem;
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
--card: oklch(1 0 0);
--card-foreground: oklch(0.145 0 0);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.145 0 0);
--primary: oklch(0.205 0 0);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.95 0 0);
--secondary-foreground: oklch(0.205 0 0);
--muted: oklch(0.97 0 0);
--muted-foreground: oklch(0.556 0 0);
--accent: oklch(0.95 0 0);
--accent-foreground: oklch(0.205 0 0);
--destructive: oklch(0.577 0.245 27.325);
--border: oklch(0.875 0 0);
--input: oklch(0.92 0 0);
--ring: oklch(0.708 0 0);
--chart-1: oklch(0.646 0.222 41.116);
--chart-2: oklch(0.6 0.118 184.704);
--chart-3: oklch(0.398 0.07 227.392);
--chart-4: oklch(0.828 0.189 84.429);
--chart-5: oklch(0.769 0.188 70.08);
--sidebar: oklch(0.985 0 0);
--sidebar-foreground: oklch(0.145 0 0);
--sidebar-primary: oklch(0.205 0 0);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.97 0 0);
--sidebar-accent-foreground: oklch(0.205 0 0);
--sidebar-border: oklch(0.922 0 0);
--sidebar-ring: oklch(0.708 0 0);
--code-background: oklch(0.985 0 0);
--code-foreground: oklch(0.145 0 0);
/* phone sidebar width, which the page slides aside to reveal */
--sidebar-reveal: min(80dvw, 20rem);
/* the desktop sidebar's muted/60 over the page, made opaque so the slid page's corners can match it */
--sidebar-reveal-tint: color-mix(in oklab, var(--muted) 60%, var(--background));
/* how far the phone sidebar is open, 0 to 1, stepped every frame by useSidebarReveal */
--sidebar-reveal-progress: 0;
/* the same on a log curve: the sidebar's contents hold on until the page nearly covers them */
--sidebar-reveal-ease: calc(log(1 + 9 * var(--sidebar-reveal-progress)) / log(10));
/* the page background, blending into the sidebar tint as the phone sidebar opens */
--sidebar-reveal-bg: color-mix(
in oklab,
var(--sidebar-reveal-tint) calc(var(--sidebar-reveal-progress) * 100%),
var(--background)
);
--font-mono:
ui-monospace, SFMono-Regular, 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas,
'Liberation Mono', Menlo, monospace;
--layer-popover: 1000000;
--chat-form-area-height: 8rem;
--chat-form-area-offset: 2rem;
--chat-form-padding-top: 6rem;
/* Nested surfaces, outermost first: the page, the sidebar on it, a group inset in the
sidebar (its footer) and a row in the group. A row keeps its corners concentric with the
group's: its radius is the group's less the padding between their edges. The sidebar's
actions above the footer share the row radius, so every action row rounds alike. See "Nested
surfaces" in the README; tests/client/nested-surfaces.svelte.test.ts holds the rule */
--surface-group-radius: 1rem;
--surface-group-padding: 0.25rem;
--surface-row-radius: calc(var(--surface-group-radius) - var(--surface-group-padding));
/* the chat form card holding one line of text, as it rests on a new chat */
--chat-form-collapsed-height: 6.375rem;
/* the empty chat form card, its text and actions in one row: a new chat centers its top edge */
--chat-form-resting-height: 3.375rem;
/* the chat form's corners while its text and actions share one row */
--chat-form-single-row-radius: 1.25rem;
/* the card's translucent fill over the page, made opaque: the phone sheet, and the page and Safari's bars around it */
--chat-form-sheet-fill: color-mix(in oklab, var(--muted) 60%, var(--background));
--max-message-height: max(24rem, min(80dvh, calc(100dvh - var(--chat-form-area-height) - 12rem)));
}
/* iOS 26 gives an installed app with viewport-fit=cover and a translucent status bar a
viewport short of that bar (WebKit bug 301108), but only while the page is shorter than
the screen. A page that reaches past it gets the full screen, after which this is 100%,
capped at the screen so it never scrolls; elsewhere the inset is 0 and it is 100% too. */
@media (display-mode: standalone) {
/* the installed app's status bar already sets them apart from the screen's edge */
:root {
--corner-control-top: calc(0.25rem + var(--safe-area-top));
}
html {
min-height: min(100lvh, calc(100% + var(--safe-area-top)));
}
}
@media (min-width: 640px) {
:root {
--chat-form-area-height: 24rem;
--chat-form-area-offset: 12rem;
--chat-form-padding-top: 6rem;
}
}
.dark {
--chat-form-sheet-fill: color-mix(in oklab, var(--muted) 75%, var(--background));
--background: oklch(0.16 0 0);
--foreground: oklch(0.985 0 0);
--card: oklch(0.205 0 0);
--card-foreground: oklch(0.985 0 0);
--popover: oklch(0.205 0 0);
--popover-foreground: oklch(0.985 0 0);
--primary: oklch(0.922 0 0);
--primary-foreground: oklch(0.205 0 0);
--secondary: oklch(0.29 0 0);
--secondary-foreground: oklch(0.985 0 0);
--muted: oklch(0.269 0 0);
--muted-foreground: oklch(0.708 0 0);
--accent: oklch(0.269 0 0);
--accent-foreground: oklch(0.985 0 0);
--destructive: oklch(0.704 0.191 22.216);
--border: oklch(1 0 0 / 30%);
--input: oklch(1 0 0 / 30%);
--ring: oklch(0.556 0 0);
--chart-1: oklch(0.488 0.243 264.376);
--chart-2: oklch(0.696 0.17 162.48);
--chart-3: oklch(0.769 0.188 70.08);
--chart-4: oklch(0.627 0.265 303.9);
--chart-5: oklch(0.645 0.246 16.439);
--sidebar: oklch(0.2 0 0);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.269 0 0);
--sidebar-accent-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(1 0 0 / 10%);
--sidebar-ring: oklch(0.556 0 0);
--code-background: oklch(0.225 0 0);
--code-foreground: oklch(0.875 0 0);
}
@theme inline {
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-card: var(--card);
--color-card-foreground: var(--card-foreground);
--color-popover: var(--popover);
--color-popover-foreground: var(--popover-foreground);
--color-primary: var(--primary);
--color-primary-foreground: var(--primary-foreground);
--color-secondary: var(--secondary);
--color-secondary-foreground: var(--secondary-foreground);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
--color-accent: var(--accent);
--color-accent-foreground: var(--accent-foreground);
--color-destructive: var(--destructive);
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);
--color-chart-1: var(--chart-1);
--color-chart-2: var(--chart-2);
--color-chart-3: var(--chart-3);
--color-chart-4: var(--chart-4);
--color-chart-5: var(--chart-5);
--color-sidebar: var(--sidebar);
--color-sidebar-foreground: var(--sidebar-foreground);
--color-sidebar-primary: var(--sidebar-primary);
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
--color-sidebar-accent: var(--sidebar-accent);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-ring: var(--sidebar-ring);
}
@layer base {
* {
@apply border-border outline-ring/50;
}
body {
@apply bg-(--sidebar-reveal-bg) text-foreground antialiased;
scrollbar-width: thin;
scrollbar-gutter: stable;
}
/* While the chat form is a full-screen sheet on a phone, the page around it takes the
sheet's fill: iOS paints the installed app's status bar and home indicator areas, and
Safari tints its bars, from this background */
@media (width < 48rem) {
html[data-chat-form-sheet],
html[data-chat-form-sheet] body {
background-color: var(--chat-form-sheet-fill);
}
}
/* no elastic bounce past the ends of the page: it drags the sticky and
fixed bars (tab bar, chat form) along and they jump back on release */
html,
body {
overscroll-behavior: none;
}
/* no gray flash over a tapped control, which has its own press state, and
no text inflation when a phone turns to landscape */
html {
-webkit-tap-highlight-color: transparent;
-webkit-text-size-adjust: 100%;
text-size-adjust: 100%;
}
/* a tap clicks at once rather than waiting to see if it is a double-tap zoom */
button,
a,
[role='button'] {
touch-action: manipulation;
}
/* holding a control does not select its label or pop the link callout;
links stay selectable, as in a message they are content */
button,
[role='button'] {
-webkit-touch-callout: none;
-webkit-user-select: none;
user-select: none;
}
/* same for dialogs, whose panels and lists scroll on their own with sticky
headers and footers. Scroll containers only: Firefox treats an
overflow-hidden box (truncated text) as one, and with `none` it would
keep the wheel from reaching the list around it */
:is([role='dialog'], [role='alertdialog']),
:is([role='dialog'], [role='alertdialog'])
:is(.overflow-auto, .overflow-y-auto, [data-slot='scroll-area-viewport']) {
overscroll-behavior: none;
}
/* Global scrollbar styling - visible only on hover */
* {
scrollbar-width: thin;
scrollbar-color: transparent transparent;
}
*:hover {
scrollbar-color: color-mix(in oklch, var(--muted-foreground) 30%, transparent) transparent;
}
*::-webkit-scrollbar {
width: 6px;
height: 6px;
}
*::-webkit-scrollbar-track {
background: transparent;
}
*::-webkit-scrollbar-thumb {
background: transparent;
border-radius: 3px;
transition: background 0.2s ease;
}
*:hover::-webkit-scrollbar-thumb {
background: color-mix(in oklch, var(--muted-foreground) 30%, transparent);
}
*::-webkit-scrollbar-thumb:hover {
background: color-mix(in oklch, var(--muted-foreground) 50%, transparent);
}
:where(code, pre, kbd, samp) {
font-family: var(--font-mono);
}
}
@layer utilities {
.scrollbar-hide {
/* Hide scrollbar for Chrome, Safari and Opera */
&::-webkit-scrollbar {
display: none;
}
/* Hide scrollbar for IE, Edge and Firefox */
-ms-overflow-style: none;
scrollbar-width: none;
}
/* Fade at the top edge of the chat, under the tab bar or a sticky header */
.chat-top-fade {
background: linear-gradient(
to bottom,
color-mix(in srgb, var(--background) 100%, transparent) 25%,
color-mix(in srgb, var(--background) 80%, transparent) 50%,
color-mix(in srgb, var(--background) 40%, transparent) 75%,
transparent 100%
);
}
/* The same fade at the top of a phone's screen: solid behind the status bar and the row of
corner controls under it (the menu key, the chat's header), fading out below them, so the
page scrolls away under them instead of into them. It rides on the page as it slides aside
for the sidebar and stays as it is: the rounded frame over the slid page clips it. */
.status-bar-fade {
/* down to where a page's content starts (--page-top): solid to the middle of the corner
row, then a long, even fade over its lower half and on to the content */
height: var(--page-top);
background: linear-gradient(
to bottom,
var(--background) calc(var(--corner-control-top) + 1.25rem),
color-mix(in srgb, var(--background) 55%, transparent)
calc(var(--corner-control-top) + 2.5rem),
transparent 100%
);
}
/* iOS Safari colours the screen's top, above the page, from a solid fixed element at the
page's top edge (theme-color no longer), and shows the page through it otherwise. The
fade above is a gradient, which it does not take, so this strip under it carries the
page's colour there, as the installed app has. Safari finds it by hit-testing the top
edge, so it takes taps (pointer-events: none would hide it) and is thicker than the
10px Safari ignores; what it covers sits under the fade's solid part anyway */
.status-bar-edge {
height: 0.75rem;
background-color: var(--background);
}
/* The bottom edge's counterpart, which Safari takes for its bottom toolbar the same way:
without it, it finds the chat form there and takes the form's colour */
.screen-bottom-edge {
height: 0.75rem;
background-color: var(--background);
}
/* The same fade at the bottom of a phone's screen: solid behind the home indicator and
fading out above it, so the page ends softly at the screen's edge and under the chat
form instead of running out under it. It stays through the slide as the top one does */
.screen-bottom-fade {
height: calc(var(--safe-area-bottom) + 3rem);
background: linear-gradient(
to top,
var(--background) var(--safe-area-bottom),
color-mix(in srgb, var(--background) 60%, transparent) calc(var(--safe-area-bottom) + 1.5rem),
transparent 100%
);
}
/* The sidebar's "Show more" row, stuck to its bottom: an opaque copy of the
panel's translucent muted tint, and a fade above it, like the one under
the tab bar, so the rows scrolling beneath end softly */
.sidebar-show-more {
--sidebar-surface: color-mix(in oklab, var(--muted) 60%, var(--background));
background: var(--sidebar-surface);
&::before {
content: '';
position: absolute;
inset-inline: 0;
bottom: 100%;
height: 1rem;
pointer-events: none;
background: linear-gradient(
to top,
var(--sidebar-surface) 0%,
color-mix(in srgb, var(--sidebar-surface) 60%, transparent) 50%,
transparent 100%
);
}
}
/* An opaque copy of the sidebar panel's translucent tint, under what moves
over the other sections while dragged */
.sidebar-drag-surface,
.sidebar-drag-overlay {
background: color-mix(in oklab, var(--muted) 60%, var(--background));
}
/* the copy of a chat row that follows the pointer, raised above the page */
.sidebar-drag-overlay {
box-shadow:
0 10px 30px -10px rgb(0 0 0 / 0.35),
0 0 0 1px color-mix(in srgb, var(--foreground) 12%, transparent);
}
/* While something is dragged, what it passes over takes no hover: only the
sections themselves stay targets, for the drop */
body[data-sidebar-dragging] [data-sidebar-section] * {
pointer-events: none;
}
.sidebar-drag-overlay {
position: fixed;
z-index: 1000;
border-radius: 0.5rem;
pointer-events: none;
}
/* the phone sidebar's contents zoom out and fade as the page slides back over them */
.sidebar-reveal-content {
opacity: var(--sidebar-reveal-ease);
scale: calc(0.98 + 0.02 * var(--sidebar-reveal-ease));
}
/* the slid page's fixed bars, held where they sit on screen, see useSidebarReveal */
.sidebar-reveal-pin-top {
translate: 0 var(--sidebar-reveal-pin-top, 0px);
}
.sidebar-reveal-pin-bottom {
translate: 0 calc(-1 * var(--sidebar-reveal-pin-bottom, 0px));
}
@media (prefers-reduced-motion: reduce) {
.sidebar-reveal-content {
scale: none;
}
}
.shimmer-text {
background: linear-gradient(
90deg,
var(--muted-foreground),
var(--foreground),
var(--muted-foreground)
);
background-size: 200% 100%;
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: 500;
animation: shimmer 1s linear infinite;
}
@keyframes shimmer {
to {
background-position: -200% 0;
}
}
@media (prefers-reduced-motion: reduce) {
.shimmer-text {
animation: none;
}
}
}
.mermaidTooltip {
display: none !important;
}
/*
* While the page sticks to its bottom, the pin after the messages is its only
* scroll anchor, so the browser keeps the bottom in place as content above it
* grows or realizes its size. Browsers without overflow-anchor (WebKit) never
* get the attribute, see createStickToBottom.
*/
[data-stick-to-bottom] * {
overflow-anchor: none;
}
[data-stick-to-bottom] *:has(.stick-to-bottom-pin),
[data-stick-to-bottom] .stick-to-bottom-pin {
overflow-anchor: auto;
}
.stick-to-bottom-pin {
height: 1px;
}
|