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

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

@font-face {
    font-family: 'swr';
    src: url('/public/fonts/swr-variable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'swr';
    src: url('/public/fonts/swr-variable-italic.woff2') format('woff2');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Fira Code';
    src: url('/public/fonts/firacode-regular.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Fira Code';
    src: url('/public/fonts/firacode-bold.woff2') format('woff2');
    font-weight: 700; font-style: normal; font-display: swap;
}

@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: 'swr', 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;
}
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(36vw, 120px) !important;
    max-width: min(36vw, 120px) !important;
}
.relative.flex.shrink-0.overflow-hidden.rounded-full:has(> img[src*="/public/favicon.png"]) {
    border-radius: 0 !important;
    overflow: visible !important;
    background: transparent !important;
}
img[src*="/public/favicon.png"] {
    border-radius: 0 !important;
    object-fit: contain !important;
    background: transparent !important;
}
.relative.flex.shrink-0.overflow-hidden.rounded-full:has(> img[src*="/public/favicon.png"]) [class*="rounded-full"] {
    border-radius: 0 !important;
}

/* ── Sidebar ── */

[data-sidebar="sidebar"] {
    font-family: 'swr', 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; }

code, .cl-message code, .markdown-body code,
pre code, .hljs, code.hljs, .font-mono {
    font-family: 'Fira Code', monospace !important;
    font-size: 0.85em;
}
pre, pre code, pre code.hljs,
.cl-message pre, .cl-message pre code, .cl-message pre code.hljs,
.markdown-body pre, .markdown-body pre code, .markdown-body pre code.hljs {
    background: hsl(var(--secondary)) !important;
    color: hsl(var(--foreground)) !important;
}
/* Code block wrapper — clip scrollbar to rounded corners */
.rounded-lg.border.bg-card {
    overflow: hidden !important;
    border-radius: 16px !important;
}
.rounded-lg.border.bg-card pre {
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !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-"].gzm-starter-active {
    opacity: 1;
    pointer-events: auto;
}

#starters [id^="starter-"] p {
    font-style: italic;
}

/* ── Composer ── */

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

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

button {
    font-family: 'swr', 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; }

/* ── Mobile overrides ── */

@media (max-width: 768px) {
    /* Hide LLM watermark/warning */
    .watermark { display: none !important; }

    /* Hide "About" button when conversation is active */
    body.gzm-has-messages #readme-button { display: none !important; }

    /* Subtle welcome logo — blend with background */
    #welcome-screen img.logo {
        opacity: 0.12 !important;
        filter: grayscale(1) !important;
    }

    /* Do not display logo above chat on mobile */
    img.logo.w-\[200px\] {
        display: none !important;
    }

    /* Left-align readme dialog title */
    [role="dialog"] [class*="DialogTitle"],
    [role="dialog"] h2 {
        text-align: left !important;
    }
}

/* ── Header — consistent button colours ── */

#readme-button {
    color: hsl(var(--muted-foreground)) !important;
}

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

.gzm-clerk-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;
}
.gzm-clerk-sign-in:hover {
    color: hsl(var(--foreground)) !important;
    border-color: hsl(var(--foreground)) !important;
    opacity: 1 !important;
}

#gzm-clerk-overlay {
    backdrop-filter: blur(4px);
}

/* ── Readme / About — top spacing ── */

[role="dialog"]:has(#readme-close-button) .mx-auto {
    padding-top: 3rem !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 ── */

.gzm-loader {
    display: flex;
    align-items: center;
    user-select: none;
}

.gzm-spin-bg { fill: hsl(var(--foreground)); }
.gzm-spin-fg { fill: hsl(var(--background)); }

.gzm-spin {
    animation: gzm-spin 4s cubic-bezier(0.2, 0, 0.1, 1) infinite;
    transform-box: fill-box;
    transform-origin: 50% 50%;
}

@keyframes gzm-spin {
    0%   { transform: rotate(0deg); }
    60%  { transform: rotate(720deg); }
    100% { transform: rotate(720deg); }
}
