/* Two-layer Scriban code editor. The <pre> draws coloured tokens; the <textarea>
   floats on top, transparent, to own the caret and selection. Both layers must
   match exactly in font metrics, padding, and wrapping so characters align. */

.scriban-editor {
    position: relative;
    height: 100%;
    min-height: 240px;
    background: #1e1e1e;
    border: 1px solid var(--rz-border);
    border-radius: 4px;
    overflow: hidden;
    font-family: 'Cascadia Code', 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #d4d4d4;
}

.scriban-editor-highlight,
.scriban-editor-textarea {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 10px 12px;
    border: 0;
    box-sizing: border-box;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    letter-spacing: normal;
    tab-size: 4;
    -moz-tab-size: 4;
    white-space: pre;
    overflow: auto;
}

.scriban-editor-highlight {
    pointer-events: none;
    color: inherit;
    background: transparent;
}

.scriban-editor-highlight code {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    background: transparent;
    padding: 0;
    white-space: pre;
    display: block;
}

.scriban-editor-textarea {
    color: transparent;
    caret-color: #f0f0f0;
    background: transparent;
    resize: none;
    outline: none;
    -webkit-text-fill-color: transparent;
}

.scriban-editor-textarea::selection {
    background: rgba(100, 150, 220, 0.4);
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.scriban-editor[data-readonly="true"] .scriban-editor-textarea {
    cursor: default;
}

/* Token colours — VSCode-dark-ish palette. */
.scriban-editor .scr-text       { color: #d4d4d4; }
.scriban-editor .scr-delimopen,
.scriban-editor .scr-delimclose { color: #c586c0; font-weight: 600; }
.scriban-editor .scr-comment    { color: #6a9955; font-style: italic; }
.scriban-editor .scr-keyword    { color: #569cd6; }
.scriban-editor .scr-string     { color: #ce9178; }
.scriban-editor .scr-number     { color: #b5cea8; }
.scriban-editor .scr-identifier { color: #9cdcfe; }
.scriban-editor .scr-operator   { color: #d4d4d4; }
