@import "github-markdown-css/github-markdown-light.css" layer(github-markdown-base);

@layer components {
  .markdown-body {
    max-width: none;
    background-color: transparent;
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    font-weight: var(--font-weight-regular);
    color: var(--text-primary);
    /* Message containers may use `whitespace-pre-wrap` for plain text.
       Markdown should always match assistant rendering (normal whitespace). */
    white-space: normal;
  }

  .markdown-body p,
  .markdown-body ul,
  .markdown-body ol,
  .markdown-body blockquote,
  .markdown-body table {
    font-size: inherit;
    line-height: inherit;
    color: inherit;
  }

  .markdown-body h1,
  .markdown-body h2,
  .markdown-body h3,
  .markdown-body h4,
  .markdown-body h5,
  .markdown-body h6 {
    font-family: inherit;
    color: var(--markdown-heading-color, inherit);
    font-weight: var(--font-weight-semibold);
    line-height: 1.3;
    margin-top: 0.9em;
    margin-bottom: 0.55em;
  }

  .markdown-body h6 {
    font-size: calc(var(--font-size-base) + 0.5px);
  }

  .markdown-body h5 {
    font-size: calc(var(--font-size-base) + 1px);
  }

  .markdown-body h4 {
    font-size: calc(var(--font-size-base) + 1.5px);
  }

  .markdown-body h3 {
    font-size: calc(var(--font-size-base) + 2px);
  }

  .markdown-body h2 {
    font-size: calc(var(--font-size-base) + 2.5px);
  }

  .markdown-body h1 {
    font-size: calc(var(--font-size-base) + 3px);
  }

  .markdown-body h1,
  .markdown-body h2 {
    border-bottom: none;
    padding-bottom: 0;
  }

  .markdown-body hr {
    display: none;
  }

  .markdown-body strong {
    font-weight: var(--font-weight-regular);
    color: var(--markdown-accent, var(--message-assistant-border));
  }

  .markdown-body em {
    font-style: italic;
    border-bottom: none;
    font-size: calc(var(--font-size-base) + 1.5px);
    margin-top: 0.3em;
    margin-bottom: 0.3em;
    display: inline;
  }

  .markdown-body a {
    color: var(--accent-primary);
    text-decoration: none;
  }

  .markdown-body a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
  }

  .markdown-body code {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    background-color: var(--surface-muted);
    border: 1px solid var(--border-base);
    border-radius: 4px;
    padding: 0.15em 0.35em;
  }

  .markdown-body pre code {
    padding: 0;
    border: none;
    background: transparent;
  }

  .markdown-body pre:not(.shiki) {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
    background-color: var(--surface-code);
    color: var(--text-primary);
    border: 1px solid var(--border-base);
    border-radius: 8px;
    padding: 0.75rem;
    margin: 1rem 0;
  }

  .markdown-body pre:not(.shiki) code,
  .markdown-code-block pre:not(.shiki) code {
    color: var(--text-primary);
  }

  .markdown-body blockquote {
    border-left: 3px solid var(--border-base);
    color: var(--text-secondary);
    background-color: var(--surface-muted);
    padding: 0.5rem 1rem;
    border-radius: 0 8px 8px 0;
  }

  .markdown-body ul,
  .markdown-body ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
  }

  .markdown-body ul {
    list-style-type: disc;
  }

  .markdown-body ol {
    list-style-type: decimal;
  }

  .markdown-body ul li,
  .markdown-body ol li {
    margin: 0.25rem 0;
  }

  .markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
    background-color: transparent;
  }

  .markdown-body th,
  .markdown-body td {
    border: 1px solid var(--border-base);
    padding: 0.5rem 0.75rem;
    text-align: left;
    color: var(--text-primary);
    background-color: transparent;
  }

  .markdown-body th {
    background-color: var(--surface-secondary);
  }

  .markdown-body tbody > tr:nth-child(odd) > td {
    background-color: var(--markdown-table-row-odd);
  }

  .markdown-body tbody > tr:nth-child(even) > td {
    background-color: var(--markdown-table-row-even);
  }

  .markdown-code-block {
    position: relative;
    margin: 10px 0;
    border-radius: 6px;
    background-color: var(--surface-muted);
    border: 1px solid var(--border-base);
  }

  .code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    background-color: var(--surface-secondary);
    border-bottom: 1px solid var(--border-base);
    /* border-top-left-radius: 6px;
    border-top-right-radius: 6px; */
  }

  .code-block-language {
    font-family: var(--font-family-mono);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: var(--font-size-sm);
  }

  .code-block-copy {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background-color: transparent;
    border: 1px solid var(--border-base);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
    margin-left: auto;
    font-size: var(--font-size-sm);
  }

  .code-block-copy:hover {
    background-color: var(--surface-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
  }

  .code-block-copy .copy-icon {
    width: 14px;
    height: 14px;
  }

  .code-block-copy .copy-text {
    font-family: var(--font-family-mono);
  }

  .markdown-code-block pre {
    margin: 0 !important;
    padding: 12px !important;
    overflow-x: auto;
    background-color: transparent !important;
    border-radius: 0;
  }

  .markdown-code-block code {
    background: transparent !important;
    padding: 0 !important;
  }
}
