/* meowmc.org/editor — the scene editor's layout and nothing else.
 *
 * The palette comes from the shared site.css tokens (W-1/W-2): no colour is
 * introduced here beyond those variables, and the functional status colours
 * (--status-good / --status-bad) appear only where a value is in or out of a
 * rule — the validation board and the hitbox outline in the schematic.
 * The shell links /assets/site.css itself; this file only adds the editor's
 * layout on top of those tokens.
 */

.editor-main { flex: 1 0 auto; padding: 24px 0 56px; }

.editor-head {
    max-width: 1320px;
    margin: 0 auto 20px;
    padding: 0 24px;
}
.editor-head h1 { margin: 0 0 6px; font-size: 30px; line-height: 1.2; }
.editor-head .lede { margin: 0; color: var(--secondary); max-width: 70ch; }
.editor-head .editor-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.draft-note {
    max-width: 1320px;
    margin: 0 auto 14px;
    padding: 8px 24px;
    color: var(--secondary);
    font-size: 13px;
}
.draft-note.is-hidden { display: none; }

.editor-wrap {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 360px;
    gap: 24px;
    align-items: start;
}

.editor-col { min-width: 0; }
.editor-col > section {
    background: var(--panel-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}
.editor-col > section > h2 {
    margin: 0 0 12px;
    font-size: 16px;
    line-height: 1.3;
}
.editor-col > section > h3 {
    margin: 16px 0 8px;
    font-size: 13px;
    color: var(--secondary);
    font-weight: 600;
}
.editor-col > section > h3:first-child { margin-top: 0; }

/* --- palette + templates (left column) ------------------------------------- */

.palette { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.palette-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    text-align: left;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.palette-item:hover { border-color: var(--accent); }
.palette-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.palette-icon {
    flex: 0 0 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--secondary);
}
.palette-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.palette-name { font-weight: 600; font-size: 14px; }
.palette-desc { font-size: 12.5px; color: var(--secondary); line-height: 1.45; }

.ceiling {
    margin-top: 14px;
    padding: 12px;
    background: var(--panel-deep);
    border: 1px solid var(--hairline);
    border-radius: 8px;
}
.ceiling h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.ceiling ul { margin: 0; padding-left: 18px; }
.ceiling li { font-size: 12.5px; color: var(--secondary); margin-bottom: 5px; }
.ceiling li::marker { color: var(--muted); }

.templates { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.template-item {
    width: 100%;
    text-align: left;
    padding: 9px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    font: inherit;
}
.template-item:hover { border-color: var(--accent); }
.template-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.template-name { display: block; font-weight: 600; font-size: 14px; }
.template-desc { display: block; font-size: 12.5px; color: var(--secondary); margin-top: 2px; }

/* --- io --------------------------------------------------------------------- */

.io-row-gap { margin-top: 8px; }
.file-input-hidden { display: none; }

.io-row { display: flex; flex-wrap: wrap; gap: 8px; }
.io-row .btn { flex: 1 1 auto; justify-content: center; }
.publish-note {
    margin: 12px 0 0;
    padding: 10px 12px;
    background: var(--panel-deep);
    border: 1px solid var(--hairline);
    border-radius: 8px;
    font-size: 13px;
    color: var(--secondary);
}
.publish-note strong { color: var(--text); }

/* --- pages ------------------------------------------------------------------ */

.page-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.page-tab {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    color: var(--secondary);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.page-tab:hover { color: var(--text); }
.page-tab.is-selected { border-color: var(--accent); color: var(--text); background: var(--accent-deep); }
.page-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.page-tab-add { color: var(--accent); }

.page-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.page-bar input[type=text] { flex: 1 1 140px; min-width: 100px; }
.inline-label { font-size: 13px; color: var(--secondary); }

.subpanel {
    margin: 14px 0;
    padding: 12px;
    border: 1px solid var(--hairline);
    border-radius: 8px;
    background: var(--panel-deep);
}
.subpanel.is-collapsed { opacity: 0.75; }
.subpanel > h3 { margin: 0 0 10px; font-size: 13px; color: var(--secondary); font-weight: 600; }
.subpanel > h3 label { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }

.component-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.component-list li { display: flex; gap: 8px; align-items: stretch; }
.component-item {
    flex: 1 1 auto;
    display: flex;
    gap: 10px;
    align-items: center;
    text-align: left;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 13.5px;
    cursor: pointer;
    min-width: 0;
}
.component-item:hover { border-color: var(--accent); }
.component-item.is-selected { border-color: var(--accent); background: var(--accent-deep); }
.component-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.component-type {
    flex: 0 0 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--secondary);
}
.component-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.row-buttons { display: flex; flex-direction: column; gap: 4px; }
.row-buttons .btn { padding: 4px 8px; font-size: 12px; min-height: 0; }

/* --- fields ----------------------------------------------------------------- */

.field { margin-bottom: 14px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-grid-tight { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field-grid .field { margin-bottom: 0; }
.field-inline { display: flex; flex-direction: column; gap: 4px; }
.field-inline-grow { flex: 1 1 auto; min-width: 0; margin-bottom: 0; }
.field-clear { align-self: flex-start; }

.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--secondary); margin-bottom: 5px; }
.field label.check-row, .field-inline label { font-weight: 500; }
.field input[type=text],
.field input[type=number],
.field input[type=search],
.field select,
.field textarea,
.function-head input,
.color-int {
    width: 100%;
    padding: 7px 9px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font: inherit;
    font-size: 13.5px;
}
.field textarea { resize: vertical; min-height: 44px; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible,
.function-head input:focus-visible, .color-int:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.triple { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.triple input { width: 100%; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type=color] { width: 44px; height: 32px; padding: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.color-int { flex: 1 1 auto; }
.rule { margin: 5px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.rule-special { color: var(--status-bad); }
.caption { color: var(--secondary); }

.check { width: auto !important; margin: 0; }

.empty {
    margin: 0;
    padding: 12px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-size: 13px;
}

.btn-small { padding: 5px 10px; font-size: 12.5px; }
.btn-danger { border-color: var(--status-bad); color: var(--status-bad); }
.btn-danger:hover { color: var(--status-bad); border-color: var(--status-bad); }

/* --- functions --------------------------------------------------------------- */

.function-block { margin-bottom: 12px; }
.function-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.function-head input { flex: 1 1 auto; font-family: ui-monospace, Menlo, Consolas, monospace; }

.action-wrap { margin-bottom: 8px; }
.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
}
.action-type-cell { flex: 0 0 auto; }
.action-row .rule { flex: 1 1 100%; margin: 2px 0 0; }

/* --- placeholder picker ------------------------------------------------------- */

.ph-group { margin-bottom: 16px; }
.ph-group h3 { margin: 0 0 6px; font-size: 13px; color: var(--secondary); }
.ph-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ph-item {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    align-items: baseline;
    width: 100%;
    text-align: left;
    padding: 7px 9px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.ph-item:hover { border-color: var(--accent); }
.ph-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ph-item code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--accent-strong); }
.ph-desc { color: var(--secondary); font-size: 12.5px; flex: 1 1 100%; }

/* --- properties ------------------------------------------------------------- */

.panel-kicker { margin: 0 0 6px; font-size: 13px; color: var(--secondary); font-weight: 600; }
.ceiling-mini {
    margin: 0 0 14px;
    padding: 10px 12px;
    font-size: 12.5px;
    color: var(--secondary);
    background: var(--panel-deep);
    border: 1px solid var(--hairline);
    border-radius: 8px;
}

/* --- validation board --------------------------------------------------------- */

.validation-status {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    border: 1px solid var(--border);
}
.validation-status.is-good { color: var(--status-good); border-color: var(--status-good); }
.validation-status.is-warn { color: var(--text); border-color: var(--border); }
.validation-status.is-bad { color: var(--status-bad); border-color: var(--status-bad); }
.validation-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.issue {
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.45;
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 2px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
}
.issue.is-error { border-left: 3px solid var(--status-bad); }
.issue.is-warning { border-left: 3px solid var(--muted); }
.issue-level { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.issue.is-error .issue-level { color: var(--status-bad); }
.issue.is-warning .issue-level { color: var(--muted); }
.issue-where { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; color: var(--accent-strong); }
.issue-rule { color: var(--secondary); }

/* --- preview ------------------------------------------------------------------- */

.preview-canvas {
    width: 100%;
    height: 380px;
    display: block;
    background: var(--panel-deep);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.preview-note {
    margin: 10px 0 0;
    padding: 10px 12px;
    background: var(--panel-deep);
    border: 1px solid var(--hairline);
    border-radius: 8px;
    font-size: 13px;
    color: var(--secondary);
}
.preview-note strong { color: var(--text); }

/* --- mock values ---------------------------------------------------------------- */

.mock-notes { margin: 0 0 10px; }

/* --- responsive ------------------------------------------------------------------ */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1180px) {
    .editor-wrap { grid-template-columns: 240px minmax(0, 1fr); }
    .editor-col.col-properties { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
    .editor-wrap { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
    .editor-head { padding: 0 16px; }
    .field-grid, .field-grid-tight { grid-template-columns: minmax(0, 1fr); }
    .editor-col > section { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .palette-item, .template-item, .page-tab, .component-item, .ph-item, .btn {
        transition: none;
    }
    * { animation: none !important; }
}
