/*
 * 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;
}

/* ── 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; }

.cl-message a, .markdown-body a {
    text-decoration: underline;
    text-underline-position: under;
    text-decoration-color: hsl(var(--border));
    text-decoration-thickness: 1px;
    transition: text-decoration-color 0.3s;
}
.cl-message a:hover, .markdown-body 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 — WOK heading scale ── */

.cl-message h1, .markdown-body h1 { font-size: 48px; font-weight: normal; margin: 2rem 0 1rem; }
.cl-message h2, .markdown-body h2 { font-size: 36px; font-weight: normal; margin: 2rem 0 1rem; }
.cl-message h3, .markdown-body h3 { font-size: 28px; font-weight: normal; margin: 2rem 0 1rem; }
.cl-message h4, .markdown-body h4 { font-size: 24px; font-weight: normal; margin: 2rem 0 1rem; }

.cl-message code, .markdown-body code {
    font-size: 0.85em;
}
.cl-message pre, .markdown-body pre {
    border: 1px solid hsl(var(--border)) !important;
    border-radius: 16px !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; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: hsl(var(--muted-foreground)); }
::-webkit-scrollbar-thumb:hover { background: hsl(var(--foreground)); }

/* ── Markdown ── */

.markdown-body ul, .markdown-body ol { padding-left: 1.5em; margin-bottom: 0.75rem; }
.markdown-body li { margin-bottom: 0.35rem; }
.markdown-body blockquote {
    border-left: 3px solid hsl(var(--foreground)) !important;
    background: hsl(var(--secondary)) !important;
    padding: 0.75rem 1rem !important;
    border-radius: 0 16px 16px 0 !important;
    margin: 1rem 0 !important;
}
.markdown-body table, .markdown-body th, .markdown-body td {
    border: 1px solid hsl(var(--foreground)) !important;
}
.markdown-body th { background: hsl(var(--secondary)) !important; font-weight: 500 !important; }
.markdown-body hr { border: none; border-top: 1px solid hsl(var(--border)); margin: 1.5rem 0; }

/* ── 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; }

/* ─────────────────────────────────────────────────────────────
 * Functional UI — loader, rotating starters, sign-in, 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 — single rotating suggestion ── */

#starters {
    margin-top: 2rem !important;
    position: relative;
}
#starters > div, #starters > [class*="flex"] {
    position: relative;
}
#starters [id^="starter-"] {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 1.8s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    white-space: nowrap;
}
#starters [id^="starter-"].wok-starter-active {
    opacity: 1;
    pointer-events: auto;
}
#starters [id^="starter-"] p {
    font-style: italic;
    font-family: 'wok', sans-serif !important;
}

/* ── Hide assistant avatar ── */

.relative.flex.shrink-0.overflow-hidden.rounded-full[data-state="closed"]:has(> img[alt*="Avatar"]) {
    display: none !important;
}

/* ── Streaming loader — spinning logo ── */

.wok-loader {
    display: flex;
    align-items: center;
    user-select: none;
}
.wok-spin-bg { fill: hsl(var(--foreground)); }
.wok-spin-fg { fill: hsl(var(--background)); }
.wok-spin {
    animation: wok-spin 4s cubic-bezier(0.2, 0, 0.1, 1) infinite;
    transform-box: fill-box;
    transform-origin: 50% 50%;
}
@keyframes wok-spin {
    0%   { transform: rotate(0deg); }
    60%  { transform: rotate(720deg); }
    100% { transform: rotate(720deg); }
}

/* ── Sign-in button (guest users) ── */

#readme-button {
    color: hsl(var(--muted-foreground)) !important;
}
.wok-sign-in {
    display: inline-flex;
    align-items: center;
    height: 2.25rem;
    margin-left: 0.5rem;
    padding: 0 0.75rem;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-transform: lowercase !important;
    border: 1px solid hsl(var(--border)) !important;
    border-radius: 2em !important;
    background: transparent !important;
    color: hsl(var(--muted-foreground)) !important;
    cursor: pointer;
}
.wok-sign-in:hover {
    color: hsl(var(--foreground)) !important;
    border-color: hsl(var(--foreground)) !important;
    opacity: 1 !important;
}
#wok-auth-overlay {
    backdrop-filter: blur(4px);
}

/* ── 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;
    }
}

/* ── 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');
}
