/* =============================================================================
   Wagoe Chat theme (ZZP-291)

   The wagoe.com style, tuned for a tool people keep open all day: warm paper,
   a Newsreader serif for display only, Source Sans 3 for everything else, and
   one dark-blue accent. Copper marks what is addressed to you.

   Scoped to `.chat-app` (the body), not :root: the page layout loads extra
   head styles before the pilot bundle, so a :root theme would lose to
   wagoe-tokens.css. Custom properties set on the body win for everything in
   it, whatever the load order.

   Three layers, in order:
   1. --wc-*        the chat palette, type and spacing; components use these
   2. wagoe tokens  the ui-style contract, so pilot components follow along
   3. daisyUI v5    so daisy classes (btn, badge, input) follow along

   Contrast is checked by design/zzp-291/contrast.mjs.
   ============================================================================= */

@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(../fonts/newsreader-latin.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url(../fonts/newsreader-italic-latin.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url(../fonts/source-sans-3-latin.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Source Sans 3';
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url(../fonts/source-sans-3-italic-latin.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* -----------------------------------------------------------------------------
   Light (default)
   ----------------------------------------------------------------------------- */
.chat-app {
  color-scheme: light;

  /* Surfaces: the frame is paper, what you read sits on white. */
  --wc-paper:        #FAF8F4;  /* page, side panel */
  --wc-paper-2:      #F3EFE7;  /* sidebar */
  --wc-surface:      #FFFFFF;  /* stream, cards, composer */
  --wc-hover:        #EEE9DF;  /* row hover on paper */
  --wc-rule:         #E2DCD1;  /* borders, dividers */
  --wc-rule-strong:  #CFC7B9;  /* input borders */

  /* Text */
  --wc-ink:          #1E2230;  /* body text */
  --wc-ink-2:        #5B6070;  /* secondary: purpose, meta */
  --wc-ink-3:        #646875;  /* faint: timestamps, section labels */
  --wc-on-accent:    #FFFFFF;

  /* The one accent: actions, links, unread, focus. */
  --wc-accent:       #22457F;
  --wc-accent-hover: #183461;
  --wc-accent-fill:  #22457F;  /* filled buttons; dark enough for white text */
  --wc-accent-soft:  #E7ECF4;  /* selected row, unread divider label */
  --wc-focus:        #22457F;

  /* Copper: addressed to you (mentions, needs reply, home count). */
  --wc-mark:         #C08A3E;  /* rules and dots, never text */
  --wc-mark-text:    #7A5212;  /* text on the copper tint */
  --wc-mark-soft:    #FBF1DF;  /* chip background */
  --wc-mention-bg:   #FBEBCB;  /* your own mention in a message */
  --wc-mention-row:  #FDF8EE;  /* a message that mentions you */

  /* States; urgent and error are never blue. */
  --wc-urgent:       #B42318;
  --wc-urgent-text:  #9F1D14;
  --wc-urgent-soft:  #FDECEA;
  --wc-success:      #2F6B3A;
  --wc-success-soft: #E6F2E8;
  --wc-stale:        #5B6070;  /* a loop whose nudges ran out */

  /* Avatars: muted, distinguishable, white initials pass AA on each. */
  --wc-avatar-1: #22457F;
  --wc-avatar-2: #7A5212;
  --wc-avatar-3: #2F6B3A;
  --wc-avatar-4: #6B3F7A;
  --wc-avatar-5: #8A3A2E;
  --wc-avatar-6: #3E5C66;

  /* Type: serif for display only, sans for everything you read and click. */
  --wc-font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --wc-font-sans:  'Source Sans 3', system-ui, 'Segoe UI', sans-serif;
  --wc-font-mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --wc-text-2xs:  0.6875rem;  /* 11px  gutter times, small initials */
  --wc-text-xs:   0.8125rem;  /* 13px  timestamps, labels */
  --wc-text-sm:   0.875rem;   /* 14px  UI: sidebar, buttons, meta */
  --wc-text-base: 0.9375rem;  /* 15px  messages */
  --wc-text-md:   1.0625rem;  /* 17px  panel titles (serif) */
  --wc-text-lg:   1.375rem;   /* 22px  conversation title (serif) */
  --wc-text-xl:   1.75rem;    /* 28px  page titles (serif) */
  --wc-text-2xl:  2.25rem;    /* 36px  empty states, all caught up (serif) */
  --wc-leading-body:  1.5;
  --wc-leading-tight: 1.2;
  --wc-tracking-display: -0.01em;
  --wc-tracking-label:    0.06em;

  /* Space: a 4px grid; 2px and 6px steps for nudges and chip gaps. */
  --wc-space-half: 0.125rem;
  --wc-space-1: 0.25rem;
  --wc-space-1-5: 0.375rem;
  --wc-space-2: 0.5rem;
  --wc-space-3: 0.75rem;
  --wc-space-4: 1rem;
  --wc-space-5: 1.25rem;
  --wc-space-6: 1.5rem;
  --wc-space-8: 2rem;
  --wc-space-10: 2.5rem;

  /* Shape: tight, like the buttons on wagoe.com. */
  --wc-radius-sm: 4px;   /* buttons, inputs, chips */
  --wc-radius-md: 6px;   /* avatars, cards */
  --wc-radius-lg: 10px;  /* composer, panels, dialogs */
  --wc-radius-full: 999px;

  --wc-shadow-1: 0 1px 2px rgb(30 34 48 / 0.06);
  --wc-shadow-2: 0 2px 8px rgb(30 34 48 / 0.08), 0 1px 2px rgb(30 34 48 / 0.06);
  --wc-shadow-3: 0 12px 32px rgb(30 34 48 / 0.14), 0 2px 6px rgb(30 34 48 / 0.08);

  /* Sizes: controls, icons, avatars; 44px is the narrow touch target. */
  --wc-size-control:    2rem;     /* 32px  buttons, sidebar rows */
  --wc-size-control-sm: 1.5rem;   /* 24px  inline buttons, chips */
  --wc-size-touch:      2.75rem;  /* 44px */
  --wc-size-avatar:     2.25rem;  /* 36px */
  --wc-size-avatar-sm:  1.25rem;  /* 20px */
  --wc-size-icon:       1.125rem; /* 18px */
  --wc-size-icon-sm:    0.875rem; /* 14px */
  --wc-measure:         72ch;     /* longest line of a message */
  --wc-measure-short:   40ch;     /* an empty state's line */
  --wc-card-width:      27.5rem;  /* 440px */

  --wc-backdrop: rgb(21 23 28 / 0.4);  /* behind a modal dialog */

  --wc-ease: cubic-bezier(0.2, 0, 0, 1);
  --wc-duration: 160ms;

  /* Layout */
  --wc-sidebar-width: 264px;
  --wc-panel-width:   380px;
  --wc-header-height: 64px;
  --wc-bottom-nav-height: 56px;

  /* --- ui-style token contract (wagoe-tokens.css) ---------------------------- */
  --color-primary: var(--wc-accent);
  --color-primary-hover: var(--wc-accent-hover);
  --color-primary-light: var(--wc-accent-soft);
  --color-accent: var(--wc-mark);
  --color-error: var(--wc-urgent);
  --color-success: var(--wc-success);
  --bg-primary: var(--wc-paper);
  --bg-secondary: var(--wc-paper-2);
  --bg-tertiary: var(--wc-hover);
  --surface-0: var(--wc-paper);
  --surface-1: var(--wc-surface);
  --text-primary: var(--wc-ink);
  --text-secondary: var(--wc-ink-2);
  --text-muted: var(--wc-ink-3);
  --text-on-accent: var(--wc-on-accent);
  --border-default: var(--wc-rule);
  --border-strong: var(--wc-rule-strong);
  --border-focus: var(--wc-focus);
  --font-sans: var(--wc-font-sans);
  --font-display: var(--wc-font-serif);
  --font-mono: var(--wc-font-mono);
  --radius-sm: var(--wc-radius-sm);
  --radius-md: var(--wc-radius-md);
  --radius-lg: var(--wc-radius-lg);

  /* --- daisyUI v5 ------------------------------------------------------------ */
  --color-base-100: var(--wc-surface);
  --color-base-200: var(--wc-paper);
  --color-base-300: var(--wc-paper-2);
  --color-base-content: var(--wc-ink);
  --color-primary-content: var(--wc-on-accent);
  --color-secondary: var(--wc-ink-2);
  --color-secondary-content: #FFFFFF;
  --color-accent-content: #1E2230;
  --color-neutral: var(--wc-ink);
  --color-neutral-content: var(--wc-paper);
  --color-info: var(--wc-accent);
  --color-info-content: #FFFFFF;
  --color-success-content: #FFFFFF;
  --color-warning: var(--wc-mark);
  --color-warning-content: #1E2230;
  --color-error-content: #FFFFFF;
  --radius-selector: var(--wc-radius-sm);
  --radius-field: var(--wc-radius-sm);
  --radius-box: var(--wc-radius-md);
  --border: 1px;
  --depth: 0;
  --noise: 0;

  background: var(--wc-paper);
  color: var(--wc-ink);
  font-family: var(--wc-font-sans);
  font-size: var(--wc-text-base);
  line-height: var(--wc-leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* -----------------------------------------------------------------------------
   Dark: warm ink, not inverted. The blue lightens to stay readable; buttons
   keep a deeper blue so white text on them passes. data-theme on the
   .chat-app element itself pins its theme, whatever the page's: the style
   page shows both side by side.
   ----------------------------------------------------------------------------- */
.chat-app[data-theme="dark"],
[data-theme="dark"] .chat-app:not([data-theme="light"]) {
  color-scheme: dark;

  --wc-paper:        #15171C;  /* page, side panel */
  --wc-paper-2:      #1B1E25;  /* sidebar */
  --wc-surface:      #20232B;  /* stream, cards: a step lighter, as in light */
  --wc-hover:        #292D37;
  --wc-rule:         #313543;
  --wc-rule-strong:  #3F4452;

  --wc-ink:          #ECE8E0;
  --wc-ink-2:        #A9ADB9;
  --wc-ink-3:        #8D919D;
  --wc-on-accent:    #FFFFFF;

  --wc-accent:       #93B2E8;  /* links, unread, focus */
  --wc-accent-hover: #B3C9F0;
  --wc-accent-fill:  #3D63A6;  /* filled buttons, with white text */
  --wc-accent-soft:  #1F2A3D;
  --wc-focus:        #93B2E8;

  --wc-mark:         #C08A3E;
  --wc-mark-text:    #E9B96E;
  --wc-mark-soft:    #2E2617;
  --wc-mention-bg:   #3A2F1B;
  --wc-mention-row:  #27231C;

  --wc-urgent:       #FF9C8F;
  --wc-urgent-text:  #FFB4A8;
  --wc-urgent-soft:  #3B1E1B;
  --wc-success:      #7FC48C;
  --wc-success-soft: #1E2E22;
  --wc-stale:        #A9ADB9;

  --wc-avatar-1: #3D63A6;
  --wc-avatar-2: #8A6224;
  --wc-avatar-3: #3E7D49;
  --wc-avatar-4: #7D5290;
  --wc-avatar-5: #9C4A3C;
  --wc-avatar-6: #4D707B;

  --wc-shadow-1: 0 1px 2px rgb(0 0 0 / 0.3);
  --wc-shadow-2: 0 2px 8px rgb(0 0 0 / 0.35), 0 1px 2px rgb(0 0 0 / 0.3);
  --wc-shadow-3: 0 12px 32px rgb(0 0 0 / 0.5), 0 2px 6px rgb(0 0 0 / 0.35);
  --wc-backdrop: rgb(0 0 0 / 0.55);

  --color-primary: var(--wc-accent-fill);
  --color-primary-hover: #4C73B8;
  --color-accent-content: #15171C;
  --color-neutral-content: #15171C;
  --color-warning-content: #15171C;
  --color-error-content: #15171C;
  --color-success-content: #15171C;
  --color-secondary-content: #15171C;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .chat-app:not([data-theme="light"]) {
    color-scheme: dark;
    --wc-paper: #15171C; --wc-paper-2: #1B1E25; --wc-surface: #20232B; --wc-hover: #292D37;
    --wc-rule: #313543; --wc-rule-strong: #3F4452;
    --wc-ink: #ECE8E0; --wc-ink-2: #A9ADB9; --wc-ink-3: #8D919D; --wc-on-accent: #FFFFFF;
    --wc-accent: #93B2E8; --wc-accent-hover: #B3C9F0; --wc-accent-fill: #3D63A6;
    --wc-accent-soft: #1F2A3D; --wc-focus: #93B2E8;
    --wc-mark: #C08A3E; --wc-mark-text: #E9B96E; --wc-mark-soft: #2E2617;
    --wc-mention-bg: #3A2F1B; --wc-mention-row: #27231C;
    --wc-urgent: #FF9C8F; --wc-urgent-text: #FFB4A8; --wc-urgent-soft: #3B1E1B;
    --wc-success: #7FC48C; --wc-success-soft: #1E2E22; --wc-stale: #A9ADB9;
    --wc-avatar-1: #3D63A6; --wc-avatar-2: #8A6224; --wc-avatar-3: #3E7D49;
    --wc-avatar-4: #7D5290; --wc-avatar-5: #9C4A3C; --wc-avatar-6: #4D707B;
    --wc-shadow-1: 0 1px 2px rgb(0 0 0 / 0.3);
    --wc-shadow-2: 0 2px 8px rgb(0 0 0 / 0.35), 0 1px 2px rgb(0 0 0 / 0.3);
    --wc-shadow-3: 0 12px 32px rgb(0 0 0 / 0.5), 0 2px 6px rgb(0 0 0 / 0.35);
    --wc-backdrop: rgb(0 0 0 / 0.55);
    --color-primary: var(--wc-accent-fill); --color-primary-hover: #4C73B8;
    --color-accent-content: #15171C; --color-neutral-content: #15171C;
    --color-warning-content: #15171C; --color-error-content: #15171C;
    --color-success-content: #15171C; --color-secondary-content: #15171C;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-app { --wc-duration: 0ms; }
}
