@layer components {
.attachment__attribute, .attachment__name {
    font-size: var(--font-size-sm);
    a {
        text-decoration: underline;
    }
}

lexxy-editor {
    min-height: 30vh;
}

/* Normalize dropdown toggle size to match regular toolbar buttons.
   <summary> inherits body line-height:1.5 while <button> gets UA normal,
   causing lexxy's block-size:2lh to differ (45px vs 34px).
   !important needed: unlayered lexxy CSS beats @layer components. */
lexxy-toolbar .lexxy-editor__toolbar-dropdown > summary {
    block-size: 34px !important;
    inline-size: 34px !important;
}

/* Reset our .btn overrides on lexxy dropdown action buttons.
   Lexxy doesn't set font-size/padding/etc on these, so our layered .btn leaks in. */
lexxy-link-dropdown .btn {
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    line-height: inherit;
    padding: 0.4em 0.8em;
    border-radius: 4px;
    gap: normal;
    white-space: normal;
    transition: none;
    border: none;
}


@media (max-width: 768px) {
  lexxy-toolbar {
    flex-wrap: wrap;
    max-width: 100%;
  }
}
}

/* Tighten paragraph spacing in rendered rich-text content */
.trix-content p {
  margin: 0.35em 0;
}

/* Keep rendered ActionText image/video attachments inside their content column. */
.attachment--preview img,
.attachment--preview video {
  block-size: auto;
  display: block;
  max-inline-size: 100%;
}

/* Lexxy prompt menu sizes are rem-based, but Metro UI sets html font-size:10px,
   so 0.875rem computes to 8.75px instead of the intended 14px.
   Fix by overriding the relevant CSS variables on the editor. */
lexxy-editor {
  --lexxy-radius: 4px;
  --lexxy-text-small: 0.875rem;
  --lexxy-prompt-min-width: 40ch;
  --lexxy-prompt-padding: 0.5em;
}

/* Lexxy ships its palette as unlayered :root variables, so this override must
   also stay unlayered to follow Adminka's explicit theme selection. */
:root[data-theme="dark"] {
  --lexxy-color-ink: var(--neutral-900);
  --lexxy-color-ink-medium: var(--neutral-600);
  --lexxy-color-ink-light: var(--neutral-500);
  --lexxy-color-ink-lighter: var(--color-border-darker);
  --lexxy-color-ink-lightest: var(--surface-color-muted);
  --lexxy-color-ink-inverted: var(--surface-color-light);

  --lexxy-color-accent-dark: var(--primary-700);
  --lexxy-color-accent-medium: var(--primary-500);
  --lexxy-color-accent-light: var(--color-selected-dark);
  --lexxy-color-accent-lightest: var(--color-selected);

  --lexxy-color-red: var(--error-dark);
  --lexxy-color-green: var(--success-dark);
  --lexxy-color-blue: var(--primary-700);
  --lexxy-color-purple: var(--code-text-color);

  --lexxy-color-code-token-att: var(--error-dark);
  --lexxy-color-code-token-comment: var(--neutral-500);
  --lexxy-color-code-token-function: var(--primary-700);
  --lexxy-color-code-token-operator: var(--error-dark);
  --lexxy-color-code-token-property: var(--primary-700);
  --lexxy-color-code-token-punctuation: var(--neutral-800);
  --lexxy-color-code-token-selector: var(--success-dark);
  --lexxy-color-code-token-variable: var(--warning-dark);

  --highlight-1: var(--warning-dark);
  --highlight-2: var(--warning-dark);
  --highlight-3: var(--error-dark);
  --highlight-4: var(--code-text-color);
  --highlight-5: var(--primary-700);
  --highlight-6: var(--primary-700);
  --highlight-7: var(--success-dark);
  --highlight-8: var(--warning-dark);
  --highlight-9: var(--neutral-600);

  --lexxy-shadow: 0 2px 8px var(--shadow-color);
}
