/*
 * 237Edu warm-editorial theme for the pinned LibreChat client.
 *
 * LibreChat components consume semantic RGB triplets through rgb(var(--token)).
 * Keeping the overrides at that level gives the whole application a coherent
 * brand while preserving component behavior and the user's light/dark choice.
 */

html {
  color-scheme: light;

  --presentation: 251 246 236;
  --text-primary: 26 23 20;
  --text-secondary: 74 63 53;
  --text-secondary-alt: 111 94 77;
  --text-tertiary: 111 94 77;
  --text-warning: 141 58 39;
  --text-destructive: 163 59 42;
  --link: 141 58 39;
  --link-hover: 105 40 27;
  --link-visited: 112 64 105;
  --accent-primary: 194 84 58;
  --accent-primary-hover: 141 58 39;
  --ring-primary: 194 84 58;

  --header-primary: 251 246 236;
  --header-hover: 236 223 205;
  --header-button-hover: 236 223 205;
  --surface-active: 242 201 185;
  --surface-active-alt: 236 223 205;
  --surface-hover: 236 223 205;
  --surface-hover-alt: 217 200 176;
  --surface-composer-hover: 236 223 205;
  --surface-primary: 244 236 225;
  --surface-primary-alt: 251 246 236;
  --surface-primary-contrast: 236 223 205;
  --surface-secondary: 251 246 236;
  --surface-secondary-alt: 236 223 205;
  --surface-tertiary: 236 223 205;
  --surface-tertiary-alt: 251 246 236;
  --surface-dialog: 251 246 236;
  --surface-overlay: 74 63 53;
  --surface-submit: 194 84 58;
  --surface-submit-hover: 141 58 39;
  --surface-destructive: 163 59 42;
  --surface-destructive-hover: 126 42 29;
  --surface-chat: 251 246 236;
  --surface-qr: 251 246 236;

  --border-light: 217 200 176;
  --border-light-alpha: 1;
  --border-medium-alt: 196 174 145;
  --border-medium: 196 174 145;
  --border-medium-alpha: 1;
  --border-heavy: 159 132 101;
  --border-heavy-alpha: 1;
  --border-xheavy: 111 94 77;
  --border-xheavy-alpha: 1;
  --border-destructive: 163 59 42;

  --status-success: 61 107 58;
  --status-success-subtle: 201 217 191;
  --status-success-border: 143 185 130;
  --status-success-strong: 61 107 58;
  --status-info: 74 84 124;
  --status-info-subtle: 224 225 235;
  --status-info-border: 166 171 197;
  --status-info-strong: 74 84 124;
  --status-warning: 141 88 12;
  --status-warning-subtle: 234 218 173;
  --status-warning-border: 203 166 92;
  --status-warning-strong: 141 88 12;
  --status-error: 163 59 42;
  --status-error-subtle: 236 198 188;
  --status-error-border: 205 125 108;
  --status-error-strong: 163 59 42;
  --status-neutral: 74 63 53;
  --status-neutral-subtle: 236 223 205;
  --status-neutral-border: 196 174 145;

  --surface-inverted: 26 23 20;
  --surface-inverted-hover: 74 63 53;
  --text-inverted: 244 236 225;
  --surface-fixed: 251 246 236;
  --surface-fixed-hover: 236 223 205;
  --text-fixed: 26 23 20;
  --theme-font-family: Arial, "Helvetica Neue", sans-serif;
  --theme-elevation-surface: 0 16px 36px rgb(40 25 10 / 0.14);
}

html.dark,
.dark {
  color-scheme: dark;

  --presentation: 30 25 20;
  --text-primary: 244 236 225;
  --text-secondary: 205 190 169;
  --text-secondary-alt: 173 154 131;
  --text-tertiary: 173 154 131;
  --text-warning: 224 178 99;
  --text-destructive: 224 126 106;
  --link: 230 122 92;
  --link-hover: 242 160 136;
  --link-visited: 200 152 194;
  --accent-primary: 230 122 92;
  --accent-primary-hover: 242 160 136;
  --ring-primary: 230 122 92;

  --header-primary: 30 25 20;
  --header-hover: 58 34 24;
  --header-button-hover: 58 34 24;
  --surface-active: 58 34 24;
  --surface-active-alt: 72 47 36;
  --surface-hover: 58 34 24;
  --surface-hover-alt: 72 47 36;
  --surface-composer-hover: 58 34 24;
  --surface-primary: 20 17 14;
  --surface-primary-alt: 13 11 9;
  --surface-primary-contrast: 30 25 20;
  --surface-secondary: 30 25 20;
  --surface-secondary-alt: 44 37 30;
  --surface-tertiary: 44 37 30;
  --surface-tertiary-alt: 58 34 24;
  --surface-dialog: 30 25 20;
  --surface-overlay: 0 0 0;
  --surface-submit: 194 84 58;
  --surface-submit-hover: 230 122 92;
  --surface-destructive: 163 59 42;
  --surface-destructive-hover: 190 76 57;
  --surface-chat: 30 25 20;
  --surface-qr: 251 246 236;

  --border-light: 44 37 30;
  --border-medium-alt: 72 59 47;
  --border-medium: 72 59 47;
  --border-heavy: 111 94 77;
  --border-xheavy: 173 154 131;
  --border-destructive: 224 126 106;

  --status-success: 143 185 130;
  --status-success-subtle: 38 51 34;
  --status-success-border: 61 107 58;
  --status-success-strong: 61 107 58;
  --status-info: 166 171 197;
  --status-info-subtle: 38 41 57;
  --status-info-border: 74 84 124;
  --status-info-strong: 74 84 124;
  --status-warning: 224 178 99;
  --status-warning-subtle: 58 44 21;
  --status-warning-border: 141 88 12;
  --status-warning-strong: 141 88 12;
  --status-error: 224 126 106;
  --status-error-subtle: 58 31 24;
  --status-error-border: 163 59 42;
  --status-error-strong: 163 59 42;
  --status-neutral: 205 190 169;
  --status-neutral-subtle: 44 37 30;
  --status-neutral-border: 72 59 47;

  --surface-inverted: 244 236 225;
  --surface-inverted-hover: 217 200 176;
  --text-inverted: 26 23 20;
  --surface-fixed: 251 246 236;
  --surface-fixed-hover: 236 223 205;
  --text-fixed: 26 23 20;
  --theme-elevation-surface: 0 18px 42px rgb(0 0 0 / 0.52);
}

html,
body,
#root {
  background-color: rgb(var(--surface-primary));
  color: rgb(var(--text-primary));
  font-family: var(--theme-font-family);
}

/* LibreChat's upstream dark body rule has class-level specificity. */
html.dark,
html.dark body,
html.dark #root {
  background-color: rgb(var(--surface-primary));
  color: rgb(var(--text-primary));
}

/* Artifacts are disabled for every curated model. LibreChat can still render
   its orphaned tools trigger or a previously pinned Artifacts badge from a
   user's browser preferences, so remove those inactive controls as well. */
#tools-dropdown-button,
button:has(svg.lucide-wand-sparkles),
[role='menuitem']:has(svg.lucide-wand-sparkles) {
  display: none !important;
}

::selection {
  background: rgb(var(--accent-primary) / 0.24);
  color: rgb(var(--text-primary));
}

/* Same-tab escape hatch back to the authenticated 237Edu AI page. */
#edu237-close-chat {
  position: fixed;
  top: 0.5rem;
  right: 0.75rem;
  z-index: 60;
  display: inline-flex;
  min-height: 2.25rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid rgb(var(--border-light));
  border-radius: 9999px;
  background: rgb(var(--surface-primary-alt) / 0.94);
  padding: 0.45rem 0.8rem;
  color: rgb(var(--text-primary));
  box-shadow: 0 8px 22px rgb(40 25 10 / 0.1);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  backdrop-filter: blur(10px);
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease;
}

#edu237-close-chat:hover {
  border-color: rgb(var(--accent-primary));
  background: rgb(var(--surface-hover));
  color: rgb(var(--accent-primary));
}

#edu237-close-chat:focus-visible,
#edu237-profile-home-link:focus-visible {
  outline: 2px solid rgb(var(--ring-primary));
  outline-offset: 2px;
}

#edu237-close-chat[hidden] {
  display: none;
}

#edu237-close-chat svg,
#edu237-profile-home-link svg {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

html.dark #edu237-close-chat {
  box-shadow: 0 10px 26px rgb(0 0 0 / 0.32);
}

@media (max-width: 639px) {
  #edu237-close-chat {
    width: 2.25rem;
    padding: 0;
  }

  #edu237-close-chat .edu237-close-chat-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
  }
}
