/* Astra chat — self-contained panel; avoids global serif/code styles on markdown */

.astra-chat-page-header {
  margin-bottom: 0.5rem;
}

.astra-chat-page-header h1 {
  margin-bottom: 0.25rem;
}

.astra-chat-lead {
  margin: 0;
  max-width: 42rem;
  color: var(--color-text-muted, rgb(232 236 240 / 68%));
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 0.95rem;
  line-height: 1.5;
}

.astra-chat-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding-bottom: 1.5rem;
}

.astra-chat-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 48rem;
  min-height: min(28rem, calc(100dvh - 16rem));
  max-height: calc(100dvh - 12rem);
  margin-inline: auto;
  border: 1px solid var(--color-border, rgb(232 236 240 / 16%));
  border-radius: var(--radius-sm, 6px);
  background: var(--color-bg-elevated, #1a2030);
  overflow: hidden;
}

.astra-chat-messages {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 1.1rem;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgb(232 236 240 / 22%) transparent;
}

.astra-chat-messages::-webkit-scrollbar {
  width: 8px;
}

.astra-chat-messages::-webkit-scrollbar-thumb {
  background: rgb(232 236 240 / 22%);
  border-radius: 4px;
}

.astra-chat-bubble {
  min-width: 0;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 0.95rem;
  line-height: 1.55;
  overflow-wrap: break-word;
}

.astra-chat-bubble--user {
  align-self: flex-end;
  max-width: min(22rem, 88%);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm, 6px);
  background: var(--color-accent, #5eb8c8);
  color: var(--color-bg, #0e1117);
}

.astra-chat-bubble--assistant {
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm, 6px);
  background: var(--color-bg, #0e1117);
  color: var(--color-text, #e8ecf0);
  border: 1px solid var(--color-border, rgb(232 236 240 / 12%));
}

/* Keep markdown typography inside the panel (override site Fraunces headings) */
.astra-chat-bubble--assistant :is(h1, h2, h3, h4, h5, h6) {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-weight: 600;
  line-height: 1.35;
  margin: 1rem 0 0.35rem;
  color: var(--color-text, #e8ecf0);
}

.astra-chat-bubble--assistant h2 {
  font-size: 1.05rem;
}

.astra-chat-bubble--assistant h3 {
  font-size: 1rem;
}

.astra-chat-bubble--assistant > :first-child {
  margin-top: 0;
}

.astra-chat-bubble--assistant p {
  margin: 0 0 0.65rem;
}

.astra-chat-bubble--assistant p:last-child {
  margin-bottom: 0;
}

.astra-chat-bubble--assistant ul,
.astra-chat-bubble--assistant ol {
  margin: 0.35rem 0 0.75rem;
  padding-left: 1.35rem;
}

.astra-chat-bubble--assistant li {
  margin-bottom: 0.25rem;
}

.astra-chat-bubble--assistant code {
  font-family: var(--font-mono, monospace);
  font-size: 0.86em;
  background: var(--color-code-bg, #0a0d10);
  padding: 0.12em 0.35em;
  border-radius: 3px;
}

.astra-chat-bubble--assistant pre {
  margin: 0.65rem 0;
  padding: 0.75rem 0.9rem;
  overflow-x: auto;
  background: var(--color-code-bg, #0a0d10);
  border: 1px solid var(--color-border, rgb(232 236 240 / 12%));
  border-radius: var(--radius-sm, 6px);
  font-family: var(--font-mono, monospace);
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.astra-chat-bubble--assistant pre code {
  display: block;
  padding: 0;
  background: transparent;
  font-size: inherit;
  border-radius: 0;
  white-space: inherit;
  overflow-wrap: inherit;
}

.astra-chat-bubble--error {
  align-self: stretch;
  color: #f87171;
  border-color: rgb(248 113 113 / 35%);
}

.astra-chat-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--color-border, rgb(232 236 240 / 12%));
  background: var(--color-bg, #0e1117);
}

.astra-chat-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.astra-chat-shell--active .astra-chat-starters {
  display: none;
}

.astra-chat-starter {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--color-border, rgb(232 236 240 / 16%));
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted, rgb(232 236 240 / 68%));
  cursor: pointer;
  font-size: 0.82rem;
  font-family: var(--font-sans, system-ui, sans-serif);
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.astra-chat-starter:hover {
  border-color: var(--color-accent-muted, rgb(94 184 200 / 35%));
  color: var(--color-text, #e8ecf0);
  background: var(--color-bg-elevated, #1a2030);
}

.astra-chat-composer {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  min-width: 0;
}

.astra-chat-input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.6rem 0.75rem;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 0.95rem;
  border: 1px solid var(--color-border, rgb(232 236 240 / 16%));
  border-radius: var(--radius-sm, 6px);
  resize: none;
  min-height: 2.75rem;
  max-height: 8rem;
  background: var(--color-bg-elevated, #1a2030);
  color: var(--color-text, #e8ecf0);
}

.astra-chat-input:focus {
  outline: none;
  border-color: var(--color-accent, #5eb8c8);
}

.astra-chat-send {
  flex-shrink: 0;
  padding: 0.6rem 1.1rem;
  border: none;
  border-radius: var(--radius-sm, 6px);
  background: var(--color-accent, #5eb8c8);
  color: var(--color-bg, #0e1117);
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans, system-ui, sans-serif);
}

.astra-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.astra-chat-cursor {
  animation: astra-blink 1s step-end infinite;
}

@keyframes astra-blink {
  50% { opacity: 0; }
}

@media screen and (width <= 600px) {
  .astra-chat-shell {
    min-height: min(24rem, calc(100dvh - 14rem));
    max-height: calc(100dvh - 10rem);
  }

  .astra-chat-composer {
    flex-wrap: wrap;
  }

  .astra-chat-send {
    width: 100%;
  }
}

.astra-chat-about {
  width: 100%;
  max-width: 48rem;
  margin: 1.25rem auto 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.astra-chat-about__heading {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-sans, system-ui, sans-serif);
  color: var(--color-text, #e8ecf0);
}

.astra-chat-about__body {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
  font-family: var(--font-sans, system-ui, sans-serif);
  color: var(--color-text-muted, rgb(232 236 240 / 68%));
}

.astra-chat-about__link {
  color: var(--color-accent, #5eb8c8);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.astra-chat-about__link:hover {
  border-bottom-color: var(--color-accent, #5eb8c8);
}

.astra-chat-about__link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring, 0 0 0 2px #0e1117, 0 0 0 4px #5eb8c8);
  border-radius: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
