/* Lexxy paints itself from its own `--lexxy-*` palette, declared on :root by
   the gem's lexxy-variables.css. Left alone that palette is a fixed light
   theme, so the note editor would sit in a dark page as a white slab.

   Re-point the properties that actually paint the editor at our own tokens.
   Because `.dark` and `[data-theme]` both live on <html> — which *is* :root —
   these `var()` references resolve against whichever theme is active, so the
   editor follows light/dark and any per-festival theme for free.

   Load order is the whole mechanism: this file is linked after lexxy.css in
   layouts/avr/application.html.erb. */
:root {
  --lexxy-color-ink: var(--color-text-primary);
  --lexxy-color-ink-medium: var(--color-text-secondary);
  --lexxy-color-ink-light: var(--color-text-muted);
  --lexxy-color-ink-lighter: var(--color-border-input);
  --lexxy-color-ink-lightest: var(--color-surface-alt);
  --lexxy-color-ink-inverted: var(--color-surface);

  --lexxy-color-accent-dark: var(--color-brand);
  --lexxy-color-accent-medium: var(--color-brand-400);
  --lexxy-color-accent-light: var(--color-brand-100);
  --lexxy-color-accent-lightest: var(--color-surface-raised);

  --lexxy-color-canvas: var(--color-surface);
  --lexxy-color-code-bg: var(--color-surface-alt);
  --lexxy-focus-ring-color: var(--color-ring);

  /* Inherit the page's type rather than re-declaring system-ui. */
  --lexxy-font-base: inherit;
}

/* The link dialog's field, restored after `lexxy_link_fields.js` retypes it.
 *
 * Lexxy styles that field with an `input[type="url"]` selector, and everything
 * it gives it lives in that one block: `flex: 2` against the `flex: 1` of the
 * button pair beside it, plus the border, height, and type size. Retyping the
 * field to `text` — which the anchor fix has to do — drops the lot, so the
 * field collapsed to its intrinsic ~20-character width, the two buttons took
 * the rest of the row, and a URL any longer than that could only be read by
 * scrolling it (NEX-811).
 *
 * The retype isn't optional. That input sits inside the article's own form, and
 * a `type="url"` holding `#fringepod` makes `form.checkValidity()` false even
 * with `required` off — so an anchor left in the field blocks Save, silently,
 * on a control the browser can't even focus to complain about.
 *
 * Declared against Lexxy's own `--lexxy-*` properties rather than our tokens,
 * so it keeps tracking their theme (and ours, via the mapping above) instead of
 * drifting into a second palette. Same declarations, one selector wider. */
.lexxy-editor__toolbar-dropdown--link [data-dropdown-panel] input[type="text"] {
  background-color: var(--lexxy-color-canvas);
  border: 1px solid var(--lexxy-color-ink-lighter);
  border-radius: var(--lexxy-radius);
  color: var(--lexxy-color-text);
  block-size: var(--lexxy-toolbar-button-size);
  box-sizing: border-box;
  font-size: var(--lexxy-text-small);
  flex: 2;
  inline-size: 100%;
  line-height: inherit;
  padding-block: 0;
  padding-inline: 1ch;
}

[overflowing] .lexxy-editor__toolbar-dropdown--link [data-dropdown-panel] input[type="text"] {
  min-inline-size: 100%;
}
