/* ============================================================================
   Breeze Fluid Messenger — Design Tokens
   Source of truth: stitch_aesthetic_web_chat/DESIGN.md + code.html
   Organic Minimalism × Translucent Glassmorphism
   Shared by the desktop (public/webd/theme.css) and mobile (public/webm/theme.css)
   theme layers. Tokens only — no component rules belong in this file.
   ========================================================================== */

:root {
    /* ---- Palette: Lichen Sage (primary) ------------------------------------ */
    --bz-primary: #385244;
    --bz-primary-container: #486655;
    --bz-on-primary: #ffffff;
    --bz-on-primary-container: #e3faea;
    --bz-primary-fixed: #d3ebd9;
    --bz-primary-fixed-dim: #b5d4bf;
    --bz-inverse-primary: #b1cdb9;

    /* ---- Palette: Mist Lavender (secondary) -------------------------------- */
    --bz-secondary: #605a7a;
    --bz-secondary-container: #e0d8fe;
    --bz-on-secondary: #ffffff;
    --bz-on-secondary-container: #4a4560;
    --bz-secondary-fixed: #e5deff;
    --bz-secondary-fixed-dim: #c9c2e7;

    /* ---- Palette: Earthen Terracotta (tertiary) ---------------------------- */
    --bz-tertiary: #96624c;
    --bz-tertiary-soft: #c98e75;
    --bz-on-tertiary: #ffffff;
    --bz-tertiary-container: #ffdbcd;

    /* ---- Palette: Surfaces ------------------------------------------------- */
    --bz-surface: #f8faf8;
    --bz-background: #f4f7f4;
    --bz-surface-bright: #fcfdfc;
    --bz-surface-lowest: #ffffff;
    --bz-surface-low: #f0f4f1;
    --bz-surface-container: #e9efe9;
    --bz-surface-high: #e1e8e2;
    --bz-surface-highest: #d8e1da;
    --bz-accent-soft: #eaf2eb;

    /* ---- Palette: Content -------------------------------------------------- */
    --bz-on-surface: #191f1a;
    --bz-on-surface-variant: #4d564f;
    --bz-outline: #737d75;
    --bz-outline-variant: #cbd4cd;

    /* ---- Palette: State ---------------------------------------------------- */
    --bz-error: #ba1a1a;
    --bz-error-soft: #ffdad6;
    --bz-success: #3f7d5a;
    --bz-warning: #b5751f;

    /* ---- Hairlines & veils (the "natural morning light" rim) --------------- */
    --bz-hairline: rgba(203, 212, 205, 0.55);
    --bz-hairline-soft: rgba(203, 212, 205, 0.30);
    --bz-rim-light: rgba(255, 255, 255, 0.72);
    --bz-veil-sage: rgba(56, 82, 68, 0.05);
    --bz-veil-sage-strong: rgba(56, 82, 68, 0.09);

    /* ---- Glass plates (Layer 01 / 02 / 03) --------------------------------- */
    --bz-glass-panel: rgba(248, 250, 248, 0.72);
    --bz-glass-card: rgba(255, 255, 255, 0.82);
    --bz-glass-popover: rgba(255, 255, 255, 0.94);
    --bz-glass-composer: rgba(255, 255, 255, 0.90);
    --bz-blur-panel: blur(24px) saturate(140%);
    --bz-blur-card: blur(32px) saturate(140%);
    --bz-blur-popover: blur(40px) saturate(150%);

    /* ---- Elevation: diffuse ambient light, never harsh drop shadows -------- */
    --bz-shadow-panel: 0 1px 0 var(--bz-rim-light) inset,
                       0 12px 32px -18px rgba(45, 55, 48, 0.16);
    --bz-shadow-card: 0 16px 36px -10px rgba(56, 82, 68, 0.08),
                      0 2px 8px -2px rgba(96, 90, 122, 0.06);
    --bz-shadow-popover: 0 24px 48px -12px rgba(45, 55, 48, 0.12),
                         0 0 0 1px rgba(255, 255, 255, 0.9);
    --bz-shadow-float: 0 12px 32px -8px rgba(25, 31, 26, 0.10);
    --bz-shadow-sage: 0 6px 16px -4px rgba(56, 82, 68, 0.28);
    --bz-shadow-sage-strong: 0 4px 16px rgba(56, 82, 68, 0.20);

    /* ---- Radii: pebbles eroded by water ------------------------------------ */
    --bz-r-xs: 0.375rem;
    --bz-r-sm: 0.5rem;
    --bz-r-md: 0.875rem;
    --bz-r-lg: 1.25rem;
    --bz-r-xl: 1.75rem;
    --bz-r-2xl: 2rem;
    --bz-r-3xl: 3rem;
    --bz-r-pill: 9999px;

    /* ---- Typography -------------------------------------------------------- */
    --bz-font-display: "Newsreader", "Songti SC", "STSong", "Noto Serif SC",
                       Georgia, "Times New Roman", serif;
    --bz-font-body: "Plus Jakarta Sans", "PingFang SC", "Hiragino Sans GB",
                    "Microsoft YaHei", -apple-system, BlinkMacSystemFont,
                    "Segoe UI", system-ui, sans-serif;

    --bz-text-display: 2.25rem;
    --bz-text-h1: 1.5rem;
    --bz-text-h2: 1.25rem;
    --bz-text-title: 1.125rem;
    --bz-text-body: 0.9375rem;
    --bz-text-sm: 0.8125rem;
    --bz-text-xs: 0.75rem;
    --bz-text-micro: 0.6875rem;

    --bz-leading-tight: 1.35;
    --bz-leading-body: 1.65;

    /* ---- Spacing rhythm ---------------------------------------------------- */
    --bz-space-2xs: 0.25rem;
    --bz-space-xs: 0.5rem;
    --bz-space-sm: 0.75rem;
    --bz-space-md: 1rem;
    --bz-space-lg: 1.5rem;
    --bz-space-xl: 2.5rem;

    /* ---- Motion: liquid, unhurried ---------------------------------------- */
    --bz-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --bz-ease-soft: cubic-bezier(0.4, 0.14, 0.3, 1);
    --bz-dur-fast: 160ms;
    --bz-dur: 260ms;
    --bz-dur-slow: 420ms;

    /* ---- Layout metrics ---------------------------------------------------- */
    --bz-rail-w: 72px;
    --bz-list-w: 340px;
    --bz-drawer-w: 320px;
    --bz-topbar-h: 56px;
    --bz-footbar-h: 28px;
    --bz-reading-w: 820px;
}

/* ---------------------------------------------------------------------------
   Global canvas: warm pearl white under faint organic radial blurs.
   Kept in `:where()` so every theme layer can override without specificity wars.
   ------------------------------------------------------------------------ */
:where(html) {
    -webkit-text-size-adjust: 100%;
}

:where(body) {
    font-family: var(--bz-font-body);
    color: var(--bz-on-surface);
    background-color: var(--bz-background);
    background-image:
        radial-gradient(circle at 12% 0%, rgba(215, 233, 222, 0.55) 0%, rgba(244, 247, 244, 0) 46%),
        radial-gradient(circle at 88% 8%, rgba(224, 233, 242, 0.45) 0%, rgba(244, 247, 244, 0) 44%),
        radial-gradient(circle at 78% 100%, rgba(243, 239, 239, 0.55) 0%, rgba(244, 247, 244, 0) 48%),
        radial-gradient(circle at 0% 92%, rgba(226, 238, 229, 0.40) 0%, rgba(244, 247, 244, 0) 42%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

:where(::selection) {
    background: var(--bz-primary-fixed);
    color: var(--bz-primary);
}

/* Feather-light scrollbars, sage instead of grey */
:where(*) {
    scrollbar-width: thin;
    scrollbar-color: rgba(56, 82, 68, 0.18) transparent;
}

:where(::-webkit-scrollbar) {
    width: 6px;
    height: 6px;
}

:where(::-webkit-scrollbar-track) {
    background: transparent;
}

:where(::-webkit-scrollbar-thumb) {
    background-color: rgba(56, 82, 68, 0.16);
    border-radius: var(--bz-r-pill);
}

:where(::-webkit-scrollbar-thumb:hover) {
    background-color: rgba(56, 82, 68, 0.30);
}

/* Serif display voice for headings that opt in */
.bz-display {
    font-family: var(--bz-font-display);
    font-weight: 400;
    letter-spacing: -0.015em;
}

.bz-whisper {
    font-family: var(--bz-font-display);
    font-style: italic;
    color: var(--bz-outline);
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --bz-dur-fast: 0ms;
        --bz-dur: 0ms;
        --bz-dur-slow: 0ms;
    }
}
