/* Reset, font, focus and utilities. Logical properties only, so one sheet serves RTL and LTR. */
/* Persian takes Vazirmatn; Latin text falls through to the device's own system face. */
@font-face {
  font-family: "Vazirmatn";
  src: url("/shared/fonts/vazirmatn/Vazirmatn-VF.woff2?v=33.003") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-block: 96px; }
* { scrollbar-width: thin; scrollbar-color: var(--color-fill-strong) transparent; }
body {
  margin: 0;
  min-block-size: 100dvh;
  background: var(--color-window);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--motion-base) ease, color var(--motion-base) ease;
}
/* The sky sits behind everything and never repaints, so the material over it stays cheap. It dims to read. */
body { isolation: isolate; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .75;
  background:
    radial-gradient(60% 55% at 85% -5%, var(--sky-a), transparent 72%), /* taste-skill-ignore */
    radial-gradient(55% 50% at 5% 10%, var(--sky-b), transparent 72%), /* taste-skill-ignore */
    radial-gradient(75% 55% at 50% 108%, var(--sky-c), transparent 72%); /* taste-skill-ignore */
  transition: opacity 700ms ease;
}
/* A trace of grain dithers the long fades, which would otherwise band on 8-bit screens. */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .035;
  background: 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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body:has(.empty-conversation)::before, body:has(#login-screen:not(.hidden))::before { opacity: 1; }
body:has(.message)::before { opacity: .45; }
@media (prefers-contrast: more) { body::before { display: none; } }
/* Pages cross-fade and the sidebar stays put, in browsers that can; others just navigate. */
@view-transition { navigation: auto; }
@media (min-width: 900px) { .sidebar { view-transition-name: workspace-sidebar; } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; }
/* Choosing light or dark: the old page holds still while settings.js opens the new one as a circle. */
.theme-reveal::view-transition-old(root), .theme-reveal::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.theme-reveal .sidebar { view-transition-name: none; }
.theme-reveal::view-transition { pointer-events: none; }
:root[data-motion="reduce"]::view-transition-group(*), :root[data-motion="reduce"]::view-transition-old(*), :root[data-motion="reduce"]::view-transition-new(*) { animation: none; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none; }
}
/* Persian letters join; letter-spacing would break them, so none anywhere. */
h1, h2, h3, h4 { margin: 0; font-weight: var(--weight-strong); line-height: var(--leading-tight); text-wrap: balance; }
h1 { font-size: var(--text-large); font-weight: var(--weight-bold); }
h2 { font-size: var(--text-title2); }
h3 { font-size: var(--text-body); }
p, ul, ol, dl, dd, figure { margin: 0; }
p, li { text-wrap: pretty; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--color-accent); text-underline-offset: 3px; }
img, svg { display: block; max-inline-size: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button, summary, label[for], select { cursor: pointer; touch-action: manipulation; }
a, button, summary, input, select, textarea { -webkit-tap-highlight-color: transparent; }
input, textarea { caret-color: var(--color-accent); }
button, summary, .nav-row, .button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* The chat scrolls inside its own panes; pull-to-refresh would only lose the draft's place. */
:root[data-route="chat"] { overscroll-behavior: none; }
/* Below 16px iOS zooms the page when a field takes focus. */
@media (pointer: coarse) {
  input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea { font-size: max(1rem, 16px) !important; }
}
button:disabled { cursor: not-allowed; }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
code, kbd, pre, samp { font-family: var(--font-mono); font-size: .9em; }
::selection { background: var(--color-accent-soft); }
::placeholder { color: var(--color-muted); opacity: 1; }

/* An outline follows each control's own corners and survives forced-colours mode. */
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.hidden, [hidden] { display: none !important; }
.session-screen { min-block-size: 100dvh; display: grid; align-content: center; justify-items: center; gap: var(--space-4); padding: var(--space-6); text-align: center; }
/* A quick check shows nothing at all; a slow one shows the star, then says why. */
.session-screen > * { animation: fade var(--motion-slow) var(--ease-out) .3s both; }
.session-screen .wait-star { inline-size: 40px; block-size: 40px; animation: nuqta-wait 1.6s var(--ease-in-out) infinite, fade var(--motion-slow) var(--ease-out) .3s both; }
.session-screen[aria-busy="true"] > #session-status { color: var(--color-muted); font-size: var(--text-footnote); animation-delay: 1.2s; }
.session-screen[aria-busy="false"] .wait-star { display: none; }
.sr-only {
  position: absolute; inline-size: 1px; block-size: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.ltr-value, [dir="ltr"] { unicode-bidi: isolate; }

.skip-link {
  position: absolute; inset-inline-start: var(--space-4); inset-block-start: var(--space-4);
  z-index: var(--z-menu); padding: var(--space-2) var(--space-4); border-radius: var(--radius-full);
  background: var(--color-elevated); color: var(--color-ink); box-shadow: var(--shadow-float);
  transform: translateY(-200%);
}
.skip-link:focus-visible { transform: none; }

.wordmark {
  display: inline-flex; align-items: center; gap: var(--space-2);
  color: var(--color-ink); text-decoration: none;
  font-size: var(--text-title3); font-weight: var(--weight-bold); line-height: 1;
}
@media (pointer: coarse) { .wordmark { min-block-size: 44px; } }
.brand-logo { inline-size: 30px; block-size: 30px; border-radius: 8px; }
/* The mark is the product's own glyph until brand.json supplies a logo. */
.brand-mark {
  display: grid; place-items: center; inline-size: 30px; block-size: 30px; flex: none; border-radius: 9px;
  background: var(--fill-accent); color: var(--color-on-accent); box-shadow: inset 0 .5px 0 rgb(255 255 255 / 45%), 0 1px 3px color-mix(in srgb, var(--color-accent-fill) 35%, transparent);
}
.brand-mark .icon { inline-size: 18px; block-size: 18px; stroke-width: 2; }
.brand-logo:not([hidden]) + .brand-mark { display: none; }
/* ui/brand-mark.js draws the logo inline so the two halves of the pen nuqta can move; the image stays as the fallback. */
.brand-logo.is-inlined { display: none; }
.brand-svg { inline-size: 30px; block-size: 30px; flex: none; overflow: visible; }
.nuqta-half { transform-box: fill-box; transform-origin: center; transition: transform var(--motion-base) var(--spring-bouncy); }
/* The brand teaser, once on sign-in: the halves slide in along the pen slit and meet, then the name is written in. */
/* `is-arriving` is set only when the mark is drawn before sign-in is on screen, so a late or repeated draw never replays. */
.brand-svg.is-arriving .nuqta-left { animation: nuqta-arrive-left calc(var(--motion-slow) * 2) var(--ease-out) backwards; }
.brand-svg.is-arriving .nuqta-right { animation: nuqta-arrive-right calc(var(--motion-slow) * 2) var(--ease-out) backwards; }
.login-top .wordmark:has(.brand-svg.is-arriving) [data-brand="name"] { animation: ink-in calc(var(--motion-slow) * 1.4) var(--ease-out) calc(var(--motion-slow) * 1.5) backwards; }
/* The mark answers the pointer: its halves part a little along the slit, and press it shut. */
@media (hover: hover) and (pointer: fine) {
  .wordmark:hover .nuqta-left { transform: translateX(-12%) rotate(-5deg); }
  .wordmark:hover .nuqta-right { transform: translateX(12%) rotate(-5deg); }
}
.wordmark:active .nuqta-half { transform: scale(.9); transition-duration: var(--motion-fast); }
/* Ink: text appears in the reading direction, as if it were being written. */
.ink-in { animation: ink-in calc(var(--motion-slow) * 1.6) var(--ease-out) backwards; }

.icon {
  inline-size: 20px; block-size: 20px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  transition: transform var(--motion-base) var(--spring-bouncy);
}
.icon-sm { inline-size: 16px; block-size: 16px; }
[dir="rtl"] .icon-directional { transform: scaleX(-1); }

.avatar {
  display: inline-grid; place-items: center; inline-size: 34px; block-size: 34px; flex: none; border-radius: 50%;
  background: linear-gradient(160deg, oklch(.6 .14 var(--avatar-hue, 250)), oklch(.47 .14 var(--avatar-hue, 250))); color: #fff; box-shadow: inset 0 .5px 0 rgb(255 255 255 / 35%); /* taste-skill-ignore */
  font-size: var(--text-footnote); font-weight: var(--weight-strong); line-height: 1; overflow: hidden;
}
.avatar .icon { inline-size: 60%; block-size: 60%; }

/* Materials need something behind them; without blur support they fall back to a near-solid surface. */
.material { background: var(--material-solid); box-shadow: var(--hairline), var(--shadow-float); }
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .material { background: var(--material); -webkit-backdrop-filter: var(--material-filter); backdrop-filter: var(--material-filter); }
}

@media (prefers-reduced-transparency: reduce) {
  .material { background: var(--material-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
/* Individual properties, so a menu keeps its own transform (an up menu is translated above its box). */
@keyframes menu-in { from { opacity: 0; scale: .94; } }
@keyframes sheet-in { from { translate: 0 calc(100% + var(--space-6)); } }
@keyframes bubble-in { from { opacity: 0; transform: translateY(18px) scale(.9); } }
@keyframes breathe { 50% { opacity: .45; } }
@keyframes spin { to { transform: rotate(360deg); } }
/* The halves meet: from apart along the pen slit to the joined mark (masked marks only). */
@keyframes nuqta-join { from { opacity: 0; transform: scale(.9); -webkit-mask-position: 14% 54%, 86% 46%; mask-position: 14% 54%, 86% 46%; } }
@keyframes nuqta-settle { from { transform: scale(1.15); -webkit-mask-position: 30% 52%, 70% 48%; mask-position: 30% 52%, 70% 48%; } }
@keyframes nuqta-arrive-left { from { opacity: 0; transform: translate(-6%, -70%) rotate(-10deg); } 55% { opacity: 1; } }
@keyframes nuqta-arrive-right { from { opacity: 0; transform: translate(6%, 70%) rotate(-10deg); } 55% { opacity: 1; } }
/* The mask exists only while the ink runs, so the finished text carries none. */
@keyframes ink-in {
  from { -webkit-mask-image: var(--ink-mask); mask-image: var(--ink-mask); -webkit-mask-size: 260% 100%; mask-size: 260% 100%; -webkit-mask-position: var(--ink-from) 0; mask-position: var(--ink-from) 0; }
  to { -webkit-mask-image: var(--ink-mask); mask-image: var(--ink-mask); -webkit-mask-size: 260% 100%; mask-size: 260% 100%; -webkit-mask-position: var(--ink-to) 0; mask-position: var(--ink-to) 0; }
}
:root { --ink-mask: linear-gradient(to left, #000 42%, transparent 58%); --ink-from: 0%; --ink-to: 100%; } /* taste-skill-ignore */
[dir="ltr"] { --ink-mask: linear-gradient(to right, #000 42%, transparent 58%); --ink-from: 100%; --ink-to: 0%; } /* taste-skill-ignore */
/* Mask positions move only inside a box of 40px or less; reduced motion stops on the joined frame. */
@keyframes nuqta-wait {
  0%, 100% { -webkit-mask-position: 50% 50%, 50% 50%; mask-position: 50% 50%, 50% 50%; }
  50% { -webkit-mask-position: 14% 54%, 86% 46%; mask-position: 14% 54%, 86% 46%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; scroll-behavior: auto !important;
  }
}
/* Delayed entrances must not hide their text when the travel is gone. */
@media (prefers-reduced-motion: reduce) { .login-top [data-brand="name"], .login-statement { animation-delay: 0s !important; } }
:root[data-motion="reduce"] :is(.login-top [data-brand="name"], .login-statement) { animation-delay: 0s !important; }
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after {
  animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important;
}

/* Text in the other script keeps its own direction (dir="auto") but sits on the page's reading edge. Chrome resolves
   text-align: match-parent against the element's own direction, so the edge is set physically here. */
:root[dir="ltr"] :is(.conversation-item strong, .palette-title, .question-tip) { text-align: left; }
:root[dir="rtl"] :is(.conversation-item strong, .palette-title, .question-tip) { text-align: right; }
