/*
 * Forovanta Community Software
 * Copyright (c) 2026 Zovanta Software Co. <sales@zovanta.dev> - https://zovanta.dev
 * Licensed under the Forovanta Free License Agreement. See LICENSE for details.
 *
 * The rich text editor's own sheet, loaded by `views/layout/header.php` beside
 * `assets/editor.js` on every page.
 *
 * The editor's toolbar, surface and foot live in `assets/forum.css` with the rest of the
 * board's markup; what is here is the **HTML source view** the toolbar now offers, which is
 * one swap and the state that says which half is showing. It is a file of its own rather than
 * an addition to the board's sheet because it is the editor's, and because `assets/forum.css`
 * is already the largest file in the archive — the same argument `assets/downloads.css` is
 * loaded on its three pages for.
 *
 * Inside `@layer legacy`, like every other sheet on the board: an unlayered rule beats a
 * layered one whatever its specificity, so a file that skipped the layer would silently
 * outrank the rules it was written to sit beside.
 */
@layer legacy {

/*
 * Which half of the editor is on screen.
 *
 * With the source view open the formatting surface is hidden and the `<textarea>` the form has
 * always posted is shown — the field, not a copy of it, so what gets submitted is never in
 * question. `assets/editor.js` adds `is-source` to the editor's root.
 *
 * The ready state's `display: none` on the same textarea is in `assets/forum.css`, and this
 * sheet is loaded after it, so the rule below wins the specificity tie. If the order is ever
 * reversed the toggle appears to do nothing at all, which is exactly what it did before it
 * existed.
 */
.editor.is-source .editor-surface { display: none; }

.editor.is-source .editor-input {
    display: block;
    /* Square where it meets the toolbar above it, rounded where it ends — the shape the
       surface draws in the same place. */
    border-radius: 0 calc(var(--radius) - 4px) calc(var(--radius) - 4px) 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.82rem;
    line-height: 1.65;
}

/* The toggle itself, once the source view is open: lit like any other choice on the board. */
.editor-btn.is-on { background: var(--accent-soft); color: var(--accent-soft-fg); }

} /* @layer legacy */
