/* ===== Inline content editing (signed-in users only) ===== */

/* --- Plain-text editables (`editable` helper) --- */
.inline-editable {
    outline: 1px dashed rgba(120, 120, 120, 0.45);
    outline-offset: 3px;
    border-radius: 2px;
    cursor: text;
    transition: outline-color 0.15s ease, background-color 0.6s ease;
}
.inline-editable:hover {
    outline-color: rgba(80, 130, 255, 0.7);
}
.inline-editable:focus {
    outline: 2px solid rgba(80, 130, 255, 0.9);
    background: rgba(80, 130, 255, 0.06);
}
.inline-editable--saving {
    opacity: 0.6;
}
.inline-editable--saved {
    background: rgba(60, 200, 120, 0.18);
}
.inline-editable--error {
    background: rgba(230, 70, 70, 0.2);
}

/* --- HTML block editables (`editable_html` helper) --- */

/* Containing block for the "Edit HTML" button, at specificity ZERO on purpose.
   This stylesheet loads after application.css, so a plain `.html-editable {
   position: relative }` would beat the page's own positioning — the hero CTAs
   (`.hero-ctas { position: absolute }`) then dropped out of their pinned spot
   and jumped up the hero. `:where()` keeps this a fallback for statically
   positioned blocks only; anything already absolute/fixed/sticky is its own
   containing block anyway, so the button still anchors correctly. */
:where(.html-editable) {
    position: relative;
}

.html-editable {
    outline: 1px dashed rgba(120, 120, 120, 0.45);
    outline-offset: 6px;
    border-radius: 2px;
    transition: outline-color 0.15s ease;
}
.html-editable:hover {
    outline-color: rgba(80, 130, 255, 0.7);
}
.html-editable--saved {
    outline: 2px solid rgba(60, 200, 120, 0.9);
}
.html-editable--error {
    outline: 2px solid rgba(230, 70, 70, 0.9);
}

.html-editable__btn {
    position: absolute;
    top: -10px;
    left: -10px;
    z-index: 5;
    padding: 3px 9px;
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
    color: #fff;
    background: rgba(22, 163, 74, 0.97);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    transition: background-color 0.15s ease;
}
.html-editable__btn:hover,
.html-editable__btn:focus-visible {
    background: rgba(15, 118, 62, 0.98);
}

/* Edit mode: the block is replaced by its own source. */
.html-editable--editing {
    display: block;
    outline: 2px solid rgba(80, 130, 255, 0.9);
    background: rgba(12, 14, 24, 0.92);
    border-radius: 8px;
    padding: 12px;
}
.html-editable__source {
    display: block;
    width: 100%;
    padding: 10px 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.6;
    color: #e6e6f0;
    background: #14151f;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 6px;
    resize: vertical;
    tab-size: 2;
}
.html-editable__source:focus {
    outline: none;
    border-color: rgba(80, 130, 255, 0.9);
}
.html-editable__actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.html-editable__actions button {
    padding: 6px 14px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    cursor: pointer;
}
.html-editable__save {
    color: #fff;
    background: rgba(80, 130, 255, 0.95);
    border-color: transparent;
}
.html-editable__cancel,
.html-editable__reset {
    color: #d8d8e4;
    background: transparent;
}
.html-editable__cancel:hover,
.html-editable__reset:hover {
    background: rgba(255, 255, 255, 0.08);
}
/* --- Draft banner on unpublished dynamic pages (admins only see these) --- */
.page-draft-banner {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 9px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    color: #78350f;
    background: #fef3c7;
    border-bottom: 1px solid #fcd34d;
}
