/*
 * WOK.art.pl — visual style for Chainlit
 * Colors handled by theme.json — CSS only for fonts, layout, borders, transitions
 */

/* ── Local font: wok (see @font-face below) ── */

/* ── @font-face ── */

@font-face {
    font-family: 'wok';
    src: url('/public/fonts/r.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'wok';
    src: url('/public/fonts/i.woff2') format('woff2');
    font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
    font-family: 'wok';
    src: url('/public/fonts/m.woff2') format('woff2');
    font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'wok';
    src: url('/public/fonts/b.woff2') format('woff2');
    font-weight: 700; font-style: normal; font-display: swap;
}

/* Fira Code — code snippets only */
@font-face {
    font-family: 'Fira Code';
    src: url('/public/fonts/fira-code-400.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Fira Code';
    src: url('/public/fonts/fira-code-500.woff2') format('woff2');
    font-weight: 500; font-style: normal; font-display: swap;
}

/* ── Global ── */

body {
    font-family: 'wok', sans-serif !important;
    font-size: 18px !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

/* ── Links — WOK underline style ── */

a { text-decoration: none; color: inherit; transition: opacity 0.3s; }
a:hover { opacity: 0.65; }

/* Answer text: Chainlit's markdown lives in .message-content .prose. */
.message-content .prose a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: hsl(var(--wok-accent));
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
    transition: text-decoration-color 0.3s;
}
.message-content .prose a:hover {
    text-decoration-color: currentColor;
    opacity: 1;
}

/* ── Header — lowercase nav, thin border ── */

header {
    border-bottom: 1px solid hsl(var(--border)) !important;
    padding-bottom: 0.75rem !important;
}
header h1, header a {
    text-transform: lowercase !important;
    font-weight: 500 !important;
}

/* ── Sidebar ── */

[data-sidebar="sidebar"] {
    font-family: 'wok', sans-serif !important;
    border-right: 1px solid hsl(var(--border)) !important;
}

/* ── Messages — heading scale ──
 * Sized for a heading inside an answer, not a page; bold stays. */

.message-content .prose :is(h1, h2, h3, h4) {
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
    border: 0;
    padding: 0;
    margin: 1.75rem 0 0.75rem;
}
.message-content .prose :is(h1, h2, h3, h4):first-child { margin-top: 0; }
.message-content .prose h1 { font-size: 28px; }
.message-content .prose h2 { font-size: 24px; }
.message-content .prose h3 { font-size: 22px; }
.message-content .prose h4 { font-size: 18px; }

/* Code snippets (gzm approach) — theme-variable bg + forced foreground text, so the
 * highlighter's token colours don't render illegibly. Both are set together: bg
 * alone (e.g. hardcoded #fff) leaves light tokens unreadable. */
code, pre code, .hljs, code.hljs {
    font-family: 'Fira Code', ui-monospace, monospace !important;
    font-size: 0.85em;
}
pre, pre code, pre code.hljs {
    background: hsl(var(--secondary)) !important;
    color: hsl(var(--foreground)) !important;
}
/* Chainlit frames a code block in a card (label + copy row, then the pre); the card
 * is the frame, so the pre gets none of its own. */
div:has(> div > pre > code.hljs) {
    background: hsl(var(--secondary)) !important;
    border: 1px solid hsl(var(--border) / 0.3) !important;
    border-radius: 16px !important;
    overflow: hidden;
}
div:has(> div > pre > code.hljs) > div:first-child {
    background: transparent !important;
    padding: 0.25rem 1rem !important;
}
pre code.hljs { padding: 0.75rem 1rem 1rem !important; }

/* Step bodies: no indent rule on the left. */
.step .border-l-2.border-primary {
    border-left: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* Chainlit ships Monokai, made for a dark ground; the brand is greyscale anyway. */
.hljs-keyword, .hljs-built_in, .hljs-literal, .hljs-type {
    color: hsl(var(--foreground)) !important;
    font-weight: 500;
}
.hljs-string, .hljs-number, .hljs-comment { color: hsl(var(--muted-foreground)) !important; }

/* ── Composer ── */

.cl-textarea, textarea {
    font-family: 'wok', sans-serif !important;
}

/* ── Buttons — WOK easing ── */

button {
    font-family: 'wok', sans-serif !important;
    transition: all 0.25s cubic-bezier(0.5, 0, 0.2, 1) !important;
}
button:hover { opacity: 0.65; }

/* ── Scrollbar ── */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: hsl(var(--muted-foreground)); }
::-webkit-scrollbar-thumb:hover { background: hsl(var(--foreground)); }

/* ── Markdown ── */

/* Bullet lists take an en dash; numbered lists keep their numbers. */
.message-content .prose ul { list-style: none; margin: 10px 0 0; padding: 0; }
.message-content .prose ul > li { position: relative; padding-left: 18px; margin-top: 6px; }
.message-content .prose ul > li::before {
    content: "–";
    position: absolute;
    left: 0;
    color: hsl(var(--muted-foreground));
}
/* Inline code: no chip, just the mono face. */
.message-content .prose :not(pre) > code {
    background: none;
    padding: 0;
    font-weight: 500;
}
/* A quote is an aside: quieter text between two hairlines, no italic, no bar. */
.message-content .prose blockquote {
    font-style: normal;
    border: 0;
    border-top: 1px solid hsl(var(--border) / 0.25);
    border-bottom: 1px solid hsl(var(--border) / 0.25);
    padding: 12px 0;
    margin-top: 24px;
    font-size: 15px;
    line-height: 1.55;
    color: hsl(var(--muted-foreground));
}

/* ── Tables in answers ──
 * Chainlit wraps a markdown table in a card (div.rounded-lg > div.overflow-auto >
 * table). No frame, no cell borders: the header is a micro-label in the accent
 * over an accent rule. Nothing guesses which column holds numbers: a column the
 * markdown right-aligns (`---:`, rendered as style="text-align: right") takes the
 * mono face; every other column stays left. */
.message-content .prose .rounded-lg:has(> .overflow-auto > table) {
    margin-top: 28px !important;
    margin-bottom: 21px !important;   /* text below sits as far as the text above */
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
.message-content .prose table tr { border: 0; }
.message-content .prose thead tr { border-bottom: 2px solid hsl(var(--wok-accent)); }
.message-content .prose tbody tr { border-bottom: 1px solid hsl(var(--border) / 0.2); }
.message-content .prose tbody tr:last-child { border-bottom: 0; }
.message-content .prose tbody tr:hover { background: hsl(var(--wok-accent) / 0.05); }
.message-content .prose th {
    height: auto;
    padding: 0 0 8px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: hsl(var(--wok-accent));
}
.message-content .prose td {
    padding: 9px 0;
    font-variant-numeric: tabular-nums;
}
.message-content .prose :is(th, td) + :is(th, td) { padding-left: 28px; }
.message-content .prose td[style*="right"] {
    font-family: 'Fira Code', ui-monospace, monospace;
    font-size: 14px;
}
/* The first column labels the rows, so it stays left even when it holds numbers
 * (a rank). !important beats the inline style the markdown alignment sets. */
.message-content .prose :is(th, td):first-child { text-align: left !important; }

/* ── Answer footer (provenance.footer) ──
 * Built by the app, not the model: a rule, a heading, then each study read with
 * the survey questions behind the answer. Its headings are h5 (the footer's own)
 * and h6 (a study), levels nothing else in an answer uses, so they mark it:
 * micro-labels like the study line of „Jak to policzyliśmy", studies in the accent. */
.message-content .prose [data-orientation="horizontal"]:has(+ h5) {
    margin: 40px 0 22px;
    background: hsl(var(--border) / 0.25);
}
.message-content .prose :is(h5, h6) {
    margin: 0;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: hsl(var(--muted-foreground));
}
.message-content .prose h6 { color: hsl(var(--wok-accent)); }
.message-content .prose h5 + h6 { margin-top: 14px; }
.message-content .prose h6 + h6 { margin-top: 10px; }
.message-content .prose ul + h6 { margin-top: 22px; }
.message-content .prose h6 + ul { margin: 8px 0 0; }
.message-content .prose h6 + ul > li { font-size: 15px; margin-top: 4px; }

/* ── Tooltip ── */

[role="tooltip"] { border-radius: 2em !important; font-size: 13px !important; }

/* ── Footer ── */

footer { border-top: 1px solid hsl(var(--border)) !important; font-size: 14px !important; }
footer a { text-transform: lowercase !important; }

/* Hairlines take the text colour, faint: the theme's --border is too dark to show
 * at this weight on the dark ground. */
:root { --wok-rule: hsl(var(--foreground) / 0.14); }
html.dark { --wok-rule: hsl(var(--foreground) / 0.3); }

/* ─────────────────────────────────────────────────────────────
 * Functional UI — rotating starters, the SQL button, logo sizing
 * ───────────────────────────────────────────────────────────── */

/* ── Logo sizing ── */

img.logo {
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
}
header img.logo {
    width: min(52vw, 210px) !important;
    max-width: min(52vw, 210px) !important;
}
#welcome-screen img.logo {
    width: min(32.4vw, 108px) !important;
    max-width: min(32.4vw, 108px) !important;
}

/* ── Starters — three quiet cards (loader.js §2) ──
 * Muted on purpose: the composer stays the strongest thing on the page. Three
 * columns on a wide screen, a sideways scroll on a phone. */

#starters {
    margin-top: 2rem !important;
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px !important;
}
#starters > div, #starters > [class*="flex"] {
    display: contents;
}
#starters [id^="starter-"] {
    display: none;
    height: auto;
    width: auto;
    padding: 12px 14px;
    border: 1px solid var(--wok-rule);
    border-radius: 14px;
    background: transparent;
    text-align: left;
    white-space: normal;
    align-items: flex-start;
    justify-content: flex-start;
}
#starters [id^="starter-"].wok-starter-active {
    display: flex;
}
#starters [id^="starter-"]:hover {
    border-color: hsl(var(--foreground) / 0.35);
    background: transparent;
}
#starters [id^="starter-"] p {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    font-size: 13.5px;
    line-height: 1.45;
    color: hsl(var(--muted-foreground) / 0.85);
    font-family: 'wok', sans-serif !important;
}
#starters [id^="starter-"]:hover p {
    color: hsl(var(--foreground));
}
@media (max-width: 640px) {
    #starters {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        margin-right: -1rem;
        padding-right: 1rem;
        scrollbar-width: none;
    }
    #starters [id^="starter-"] {
        flex: 0 0 72% !important;
        max-width: none !important;
        scroll-snap-align: start;
    }
}

/* ── Hide assistant avatar ──
 * Chainlit puts the avatar in a span.inline-block, first in div.ai-message (a flex
 * row with gap-4). Hiding only the image left the span and its 16px gap, so every
 * answer started 16px right of the edge the composer and user messages share. The
 * span goes whole; the image is not a reliable handle, since Radix inserts it only
 * once loaded. The error icon Chainlit puts in the same place stays. */
.ai-message > span.inline-block:first-child:not(:has(.fill-destructive)) {
    display: none !important;
}

/* ── SQL step → the „sql" button (loader.js §4) ──
 * The step keeps its Radix accordion; only its own trigger row is hidden, and
 * the whole block collapses while closed so it leaves no gap under the answer. */

h3:has(> [id="step-Jak to policzyliśmy"]) {
    display: none;
}
.step:has([id="step-Jak to policzyliśmy"][data-state="closed"]) {
    display: none;
}

/* The block's markdown (provenance.calculation_markdown), per query: *study*,
 * #### question, the SQL, a list of `CODE` stems; queries split by ---. Chainlit
 * renders a paragraph as div[role=article], *x* as span.italic, --- as a separator
 * div. The study line carries the query's number, hung in the left margin in the
 * one accent colour, so number and study line share a top edge. */
:root { --wok-accent: 251 100% 58%; }   /* #4F2BFF */
html.dark { --wok-accent: 251 100% 76%; }   /* same hue, readable on the dark ground */

.step:has([id="step-Jak to policzyliśmy"]) .border-l-2.border-primary {
    counter-reset: wok-query;
    padding-left: 64px !important;
    font-size: 16px;
}
.step:has([id="step-Jak to policzyliśmy"]) [role="article"]:has(> .italic:only-child) {
    position: relative;
    counter-increment: wok-query;
    margin: 0;
    line-height: 1.2;
}
.step:has([id="step-Jak to policzyliśmy"]) [role="article"]:has(> .italic:only-child)::before {
    content: counter(wok-query, decimal-leading-zero);
    position: absolute;
    left: -64px;
    top: -2px;
    font-size: 34px;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: hsl(var(--wok-accent));
}
.step:has([id="step-Jak to policzyliśmy"]) [role="article"] > .italic:only-child {
    font-style: normal;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: hsl(var(--muted-foreground));
}
.step:has([id="step-Jak to policzyliśmy"]) h4 {
    font-size: 18px;
    font-weight: 400;
    letter-spacing: normal;
    line-height: 1.35;
    margin: 6px 0 10px;
}
.step:has([id="step-Jak to policzyliśmy"]) [data-orientation="horizontal"].bg-border {
    margin: 28px 0;
    background: hsl(var(--border) / 0.25);
}
.step:has([id="step-Jak to policzyliśmy"]) ul {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
}
.step:has([id="step-Jak to policzyliśmy"]) ul > li {
    font-size: 14px;
    margin: 0 0 4px;
    padding-left: 0;
}
.step:has([id="step-Jak to policzyliśmy"]) ul > li::before { content: none; }
.step:has([id="step-Jak to policzyliśmy"]) li code {
    font-size: 11.5px;
    font-weight: 500;
    margin-right: 0.6em;
    padding: 0 !important;
    background: none !important;
    color: hsl(var(--wok-accent)) !important;
}
@media (max-width: 768px) {
    .step:has([id="step-Jak to policzyliśmy"]) .border-l-2.border-primary { padding-left: 0 !important; }
    .step:has([id="step-Jak to policzyliśmy"]) [role="article"]:has(> .italic:only-child)::before {
        position: static;
        font-size: inherit;
        letter-spacing: 0.14em;
        margin-right: 0.8em;
    }
}

/* Right after the thumbs, set apart by a short rule in the gap before it.
 * Hover as on copy and thumbs (Chainlit's ghost button). */
.wok-sql-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 2.25rem;
    margin-left: 1.1rem;
    padding: 0 0.6rem;
    font-size: 14px !important;
    border-radius: calc(var(--radius) - 2px) !important;
    background: transparent !important;
    color: hsl(var(--muted-foreground)) !important;
    cursor: pointer;
}
.wok-sql-toggle::before {
    content: "";
    position: absolute;
    left: -0.6rem;
    top: 50%;
    width: 1px;
    height: 1rem;
    transform: translateY(-50%);
    background: hsl(var(--border));
}
.wok-sql-toggle:hover {
    background: hsl(var(--accent)) !important;
    color: hsl(var(--accent-foreground)) !important;
}

/* The button's hover bubble (loader.js §4), drawn like Chainlit's tooltips. */
.wok-tooltip {
    position: fixed;
    z-index: 50;
    padding: 0.375rem 0.75rem;
    font-size: 13px;
    white-space: nowrap;
    pointer-events: none;
    border: 1px solid hsl(var(--border));
    border-radius: 2em;
    background: hsl(var(--popover));
    color: hsl(var(--popover-foreground));
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* ── Header buttons ── */

#readme-button {
    color: hsl(var(--muted-foreground)) !important;
}
#wok-auth-overlay {
    backdrop-filter: blur(4px);
}

/* ── „O projekcie" (chainlit_pl-PL.md) ──
 * Chainlit opens the readme as a full-screen dialog (the only one with
 * .max-w-screen): its title, then the markdown. Set like an answer, with room
 * above. The first paragraph is the WUK logo, the last the WOK logo; Chainlit
 * frames each image in a 16:9 grey box, which is undone here. */
[role="dialog"].max-w-screen > div {
    width: 100%;
    padding: clamp(40px, 10vh, 112px) 0 96px;
}
[role="dialog"].max-w-screen > div > div:first-child h2 {
    text-align: left;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: hsl(var(--wok-accent));
}
[role="dialog"].max-w-screen .prose {
    max-width: none;
    overflow: visible;
    font-size: 18px;
    line-height: 1.6;
}
[role="dialog"].max-w-screen .prose > [role="article"]:first-child {
    padding-bottom: 36px;
    margin-bottom: 36px;
    border-bottom: 1px solid var(--wok-rule);
}
/* wuk-cropped.svg is wuk_light.svg cut to its drawing, so it starts on the
 * text's edge. WOK closes the page, after the note, on the same edge. */
[role="dialog"].max-w-screen .prose > [role="article"]:is(:first-child, :last-child) > a { display: inline-block; line-height: 0; }
[role="dialog"].max-w-screen .prose > [role="article"]:first-child > a > div { max-width: none; width: 300px; }
[role="dialog"].max-w-screen .prose > [role="article"]:last-child { margin-top: 56px; }
[role="dialog"].max-w-screen .prose > [role="article"]:last-child > a > div { max-width: none; width: 120px; }
[role="dialog"].max-w-screen .prose [data-radix-aspect-ratio-wrapper] { padding-bottom: 0 !important; }
[role="dialog"].max-w-screen .prose [data-radix-aspect-ratio-wrapper] > div {
    position: static !important;
    background: none;
    border-radius: 0;
}
[role="dialog"].max-w-screen .prose img { display: block; width: 100%; height: auto; margin: 0; }
/* Both logos are drawn in black; the dark theme inverts them to white. A filter,
 * not a `content:` swap, since Firefox draws no `content:` on an img. The logos
 * are the page's only images, and the rule does not look at src: Firefox ends it
 * with a `?`. */
html.dark [role="dialog"].max-w-screen .prose img { filter: invert(1); }

/* The lead paragraph, then sections split by hairlines; studies are named in the
 * accent, as in an answer's footer. */
[role="dialog"].max-w-screen .prose > [role="article"]:nth-child(2) {
    margin-top: 0;
    font-size: 22px;
    line-height: 1.45;
}
[role="dialog"].max-w-screen .prose h3 {
    margin: 48px 0 12px;
    padding-top: 28px;
    border-top: 1px solid var(--wok-rule);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
}
[role="dialog"].max-w-screen .prose h4 {
    margin: 28px 0 6px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    line-height: 1.5;
    text-transform: uppercase;
    color: hsl(var(--wok-accent));
}
[role="dialog"].max-w-screen .prose :is(h3, h4) + :is([role="article"], ul) { margin-top: 0; }
[role="dialog"].max-w-screen .prose a:not(:has(img)) {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: hsl(var(--wok-accent));
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}
[role="dialog"].max-w-screen .prose a:hover { opacity: 0.65; }
[role="dialog"].max-w-screen .prose ul { list-style: none; margin: 10px 0 0; padding: 0; }
[role="dialog"].max-w-screen .prose ul > li { position: relative; padding-left: 18px; margin-top: 8px; }
[role="dialog"].max-w-screen .prose ul > li::before {
    content: "–";
    position: absolute;
    left: 0;
    color: hsl(var(--muted-foreground));
}
[role="dialog"].max-w-screen .prose blockquote {
    font-style: normal;
    border: 0;
    border-top: 1px solid var(--wok-rule);
    border-bottom: 1px solid var(--wok-rule);
    padding: 16px 0;
    margin-top: 48px;
    font-size: 15px;
    line-height: 1.55;
    color: hsl(var(--muted-foreground));
}
@media (max-width: 640px) {
    [role="dialog"].max-w-screen .prose > [role="article"]:first-child > a > div { width: 240px; }
    [role="dialog"].max-w-screen .prose > [role="article"]:nth-child(2) { font-size: 19px; }
}

/* ── Mobile overrides ── */

@media (max-width: 768px) {
    .watermark { display: none !important; }
    body.wok-has-messages #readme-button { display: none !important; }
    #welcome-screen img.logo {
        opacity: 1 !important;
        filter: none !important;
    }
}

/* ── Touch screens ──
 * No tooltips: Radix opens one on focus as well as on hover, and the phone's
 * history sheet focuses its own toggle when it opens, so „Otwórz panel boczny"
 * stayed up for as long as the sheet did.
 * A chat's „…" appears on hover. iOS takes a tap that makes something appear on
 * hover as a hover only, so a chat in the list opened on the second tap. Here it
 * is shown only on the open chat, always, and a tap has nothing to reveal. */
@media (hover: none) {
    [data-radix-popper-content-wrapper]:has([role="tooltip"]) { display: none !important; }
    #thread-options { display: none !important; }
    [data-sidebar="menu-button"][data-active="true"] #thread-options {
        display: flex !important;
        opacity: 1 !important;
    }
}

/* ── „O projekcie" on phones ──
 * 100vh (h-screen) is the screen with the browser's bars hidden, taller than
 * what shows while they are up; centred, the dialog ran under the address bar
 * and took its close button along. 100dvh is the part that shows. The button
 * stays in the corner while the text scrolls, drawn like the file chips so it
 * reads over the text: a hairline circle on the page's colour, 8px from the top
 * and the right, its icon where desktop has it. */
@media (max-width: 768px) {
    [role="dialog"].max-w-screen {
        height: 100dvh !important;
        max-height: 100dvh !important;
    }
    [role="dialog"].max-w-screen > button.absolute {
        position: sticky;
        top: -16px;  /* measured from inside the dialog's 24px padding */
        right: auto;  /* Chainlit's right-4, as a sticky inset, held it off the corner */
        z-index: 1;
        order: -1;
        align-self: flex-end;
        display: flex;
        align-items: center;
        justify-content: center;
        flex: none;
        width: 32px;
        height: 32px;
        margin: -16px -16px -32px 0;  /* no room taken from the text below */
        border: 1px solid hsl(var(--border) / 0.35);
        border-radius: 50%;
        background: hsl(var(--background));
        box-shadow: none !important;  /* the dialog focuses it on open; the ring framed it */
    }
    /* A finger-sized target around the 32px circle. */
    [role="dialog"].max-w-screen > button.absolute::after { content: ""; position: absolute; inset: -6px; }
}

/* ── Brand logo above the chat (welcome screen) ──
 * Swaps the welcome-screen logo for the WUK wordmark while leaving the
 * header logo untouched. `content:` replaces the rendered <img>; theme-aware.
 */
#welcome-screen img.logo {
    content: url('/public/wuk_light.svg');
    width: min(60vw, 360px) !important;
    max-width: min(60vw, 360px) !important;
    height: auto !important;
}
html.dark #welcome-screen img.logo,
.dark #welcome-screen img.logo {
    content: url('/public/wuk_dark.svg');
}

/* ── Questionnaire downloads — the file card as a small pill (loader.js §5) ──
 * loader.js replaces the inside of Chainlit's a.inline-file (type icon, name,
 * hover tooltip) with .wok-file: a download glyph and the name. */
/* The pills sit a line below the answer's last paragraph, on the anchor itself so
   it holds whatever Chainlit wraps the elements in. */
a.inline-file { display: inline-block; max-width: 100%; margin: 0.375rem 0.5rem 0 0; }
/* Chainlit lays the files out in one flex row (`flex items-center gap-2`) that never
   wraps, so on a phone the second pill runs off the screen. */
div:has(> div > a.inline-file) { flex-wrap: wrap; row-gap: 0; }
div:has(> a.inline-file) { min-width: 0; max-width: 100%; }
/* The glyph and the file type take the accent, as survey codes do in
   „Jak to policzyliśmy"; the study's name keeps the text colour. */
.wok-file {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
    height: 30px;
    padding: 0 12px 0 10px;
    font-size: 14px;
    border: 1px solid hsl(var(--border) / 0.35);
    border-radius: 2em;
    color: hsl(var(--foreground));
}
a.inline-file:hover .wok-file {
    border-color: hsl(var(--wok-accent) / 0.5);
    background: hsl(var(--wok-accent) / 0.05);
}
.wok-file svg { width: 1em; height: 1em; flex: none; color: hsl(var(--wok-accent)); }
/* A name too long for a narrow screen is cut on one line, never spilled out of the pill. */
.wok-file-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wok-file-type {
    flex: none;
    font-family: 'Fira Code', ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: hsl(var(--wok-accent));
}

/* ── Study switches (loader.js §6) ──
 * One pill per study in the composer's tool row, drawn like the download pills: a
 * switched-on study takes the accent and a check, a switched-off one is muted. */
.wok-studies { display: flex; flex-wrap: wrap; gap: 0.375rem; padding-left: 0.375rem; }
.wok-study {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 26px;
    padding: 0 10px 0 8px;
    font-size: 13px !important;
    font-weight: 400 !important;
    letter-spacing: 0.01em;
    border: 1px solid hsl(var(--border) / 0.25);
    border-radius: 2em !important;
    background: transparent;
    color: hsl(var(--muted-foreground) / 0.8);
    cursor: pointer;
}
.wok-study svg { width: 0.9em; height: 0.9em; flex: none; }
.wok-study[aria-pressed="true"] {
    border-color: hsl(var(--wok-accent) / 0.3);
    color: hsl(var(--muted-foreground));
}
.wok-study[aria-pressed="true"] svg { color: hsl(var(--wok-accent)); }
.wok-study:hover { opacity: 1 !important; border-color: hsl(var(--wok-accent) / 0.5); }
.wok-study[data-locked] { cursor: default; }

/* ── Answer in progress — three dots in the scroll arrow's place (loader.js §9) ──
 * While a turn runs (body.wok-running) the dots show and Chainlit's arrow is hidden
 * under them; after it, they fade out as the arrow fades in. The pill replaces
 * Chainlit's pulsing dot at the end of the text. */
.loading-cursor { display: none !important; }
.wok-progress { pointer-events: none; opacity: 0; transition: opacity 0.25s ease; }
.wok-running .wok-progress { opacity: 1; }
.wok-running .wok-progress button { pointer-events: auto; }
.wok-progress button { gap: 3px; }
.wok-progress i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;  /* the arrow's colour */
    animation: wok-dot 1.2s ease-in-out infinite;
}
.wok-progress i:nth-child(2) { animation-delay: 0.15s; }
.wok-progress i:nth-child(3) { animation-delay: 0.3s; }
@keyframes wok-dot { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }
.absolute:has(> button > .lucide-arrow-down) {
    animation: wok-fade-in 0.25s ease;
    transition: opacity 0.25s ease;
}
.wok-running .absolute:has(> button > .lucide-arrow-down) {
    opacity: 0 !important;
    pointer-events: none;
}
@keyframes wok-fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .wok-progress i { animation: none; opacity: 0.7; }
}

/* ── Institution profile (public/elements/InstitutionProfile.jsx) ──
 * Rendered by the app outside .prose, so it restates the answer's own styles:
 * the heading scale, the table (accent micro-labels over an accent rule, hairline
 * rows, mono numbers), the en-dash list and the source footer. The only addition
 * is the bar: the institution's share in the accent, the study's as a tick. */
.ip { margin-top: 28px; font-size: 16px; line-height: 1.55; width: 100%; }
.ip :is(h2, h3, h4) { font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; margin: 0; }
.ip h2 { font-size: 24px; margin-top: 4px; }
.ip-wave { color: hsl(var(--wok-accent)); }
.ip h3 { font-size: 22px; margin: 2.5rem 0 0.75rem; }
.ip h4 { font-size: 18px; margin-top: 1.75rem; }
.ip p { margin: 0; }
.ip-kicker, .ip-sources :is(h5, h6), .ip-dep h5, .ip-ref h5, .ip-head, .ip-facts span {
    font-size: 11px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: hsl(var(--muted-foreground));
}
.ip-note { font-size: 14px; color: hsl(var(--muted-foreground)); margin-top: 4px !important; }

.ip-facts { display: flex; flex-wrap: wrap; gap: 14px 40px; margin-top: 22px; }
.ip-facts > div { display: flex; flex-direction: column; max-width: 320px; }
.ip-facts b { font-size: 28px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.ip-facts span { margin-top: 2px; }

.ip-list { list-style: none; margin: 10px 0 0; padding: 0; }
.ip-list > li { position: relative; padding-left: 18px; margin-top: 6px; }
.ip-list > li::before { content: "–"; position: absolute; left: 0; color: hsl(var(--muted-foreground)); }
.ip-list > li > span { color: hsl(var(--muted-foreground)); font-size: 14px; }

.ip-legend { font-size: 14px; color: hsl(var(--muted-foreground)); }
.ip-legend p + p { margin-top: 6px; }
.ip-legend b { font-weight: 500; color: hsl(var(--foreground)); }
.ip-legend span { display: inline-block; vertical-align: middle; }
.ip-key-bar { width: 18px; height: 8px; margin-right: 6px; background: hsl(var(--wok-accent)); }
.ip-key-ref { width: 2px; height: 14px; margin: 0 6px 0 18px; background: hsl(var(--foreground)); }
.ip h3.ip-block { margin-top: 2.25rem; }

/* What stands out: one row per answer — its name, the bar, the two shares, and how
 * many times more or less often than on average. */
.ip-dep { margin-top: 22px; }
.ip-dep h5 { margin: 0 0 4px; color: hsl(var(--wok-accent)); padding-bottom: 8px; border-bottom: 2px solid hsl(var(--wok-accent)); }
.ip-dep-row {
    display: grid;
    grid-template-columns: minmax(0, 36%) minmax(90px, 1fr) 150px 120px;
    column-gap: 14px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid hsl(var(--border) / 0.2);
}
.ip-dep-row:last-child { border-bottom: 0; }
.ip-dep-label { font-weight: 600; }
.ip-dep-label, .ip-label { min-width: 0; overflow-wrap: anywhere; }
.ip-dep-label span { display: block; font-weight: 400; font-size: 13px; line-height: 1.4; color: hsl(var(--muted-foreground)); }
.ip-dep-nums { text-align: right; white-space: nowrap; font-size: 14px; color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; }
.ip-dep-nums b { font-weight: 600; color: hsl(var(--foreground)); }
.ip-dep-times { text-align: right; white-space: nowrap; font-weight: 600; color: hsl(var(--wok-accent)); }

.ip-head, .ip-row {
    display: grid;
    grid-template-columns: minmax(0, 32%) 56px 70px minmax(80px, 1fr) 70px 132px;
    column-gap: 14px;
    align-items: center;
}
.ip-head { margin-top: 14px; padding-bottom: 8px; color: hsl(var(--wok-accent)); border-bottom: 2px solid hsl(var(--wok-accent)); }
.ip-row { padding: 9px 0; border-bottom: 1px solid hsl(var(--border) / 0.2); }
.ip-row:last-child { border-bottom: 0; }
.ip-row:hover { background: hsl(var(--wok-accent) / 0.05); }
.ip-num { text-align: right; white-space: nowrap; }
.ip-row .ip-num { font-family: 'Fira Code', ui-monospace, monospace; font-size: 14px; font-variant-numeric: tabular-nums; }
.ip-marked { color: hsl(var(--wok-accent)); font-weight: 600; }
.ip-none { color: hsl(var(--muted-foreground)); }
.ip-row .ip-num:last-child { font-family: inherit; font-size: 15px; }
.ip-same { font-size: 13px; color: hsl(var(--muted-foreground)); }

/* What "the average" is, said once, before anything is compared with it. */
.ip-ref { margin-top: 28px; padding: 14px 18px; border-left: 2px solid hsl(var(--wok-accent)); background: hsl(var(--wok-accent) / 0.05); }
.ip-ref h5 { margin: 0 0 4px; color: hsl(var(--wok-accent)); }
.ip-ref p { font-size: 15px; }

.ip-bar { position: relative; height: 10px; background: hsl(var(--border) / 0.15); }
.ip-bar i { position: absolute; inset: 0 auto 0 0; background: hsl(var(--wok-accent)); }
.ip-bar u { position: absolute; top: -4px; bottom: -4px; width: 2px; background: hsl(var(--foreground)); }

/* Dumbbell: here (filled, accent) and on average (hollow, like the bar's tick). */
.ip-db { position: relative; height: 12px; }
.ip-db s { position: absolute; top: 5px; height: 2px; background: hsl(var(--wok-accent) / 0.45); }
.ip-db :is(i, u) { position: absolute; top: 0; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; box-sizing: border-box; }
.ip-db i { background: hsl(var(--wok-accent)); }
.ip-db u { background: hsl(var(--background)); border: 2px solid hsl(var(--foreground)); }
.ip-key-dot, .ip-key-hollow { width: 10px; height: 10px; border-radius: 50%; margin: 0 6px 0 4px; box-sizing: border-box; }
.ip-key-dot { background: hsl(var(--wok-accent)); }
.ip-key-hollow { margin-left: 14px; border: 2px solid hsl(var(--foreground)); }

.ip-sources { margin-top: 40px; padding-top: 22px; border-top: 1px solid hsl(var(--border) / 0.25); }
.ip-sources :is(h5, h6) { margin: 0; }
.ip-sources h6 { color: hsl(var(--wok-accent)); margin-top: 14px; }
.ip-sources h6 a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.ip-sources .ip-list { margin-top: 8px; }
.ip-sources .ip-list > li { font-size: 15px; margin-top: 4px; }

/* On a phone the answer takes its own line and the count column goes away, so
 * nothing scrolls sideways. */
@media (max-width: 640px) {
    .ip-head, .ip-row { grid-template-columns: 58px minmax(40px, 1fr) 58px 76px; column-gap: 10px; row-gap: 3px; }
    .ip-label { grid-column: 1 / -1; }
    .ip-n, .ip-head .ip-label, .ip-wide { display: none; }
    .ip-dep-row { grid-template-columns: minmax(50px, 1fr) auto; row-gap: 6px; }
    .ip-dep-label, .ip-dep-nums { grid-column: 1 / -1; }
    .ip-dep-nums { text-align: left; order: 3; }
    .ip-dep-row .ip-bar { order: 1; }
    .ip-dep-times { order: 2; }
    .ip-key-ref { margin-left: 12px; }
}
