/**
 * MCE Embed Module styles
 *
 * Two audiences:
 * 1. The "Embed this calculator" panel on full calculator pages
 *    (enqueued from the panel renderer with filemtime versioning).
 * 2. The bare embed document at /embed/{slug}/ (inlined there).
 *
 * The engine stylesheet has no CSS custom properties, so this file
 * introduces --mce-accent with the engine's hardcoded defaults as
 * fallback (#0073aa primary, #005a87 hover).
 */

/* ---------- Snippet panel (full pages and embed doc share markup) ---- */

.mce-embed-panel {
    border-top: 1px solid #e0e0e0;
    margin-top: 1rem;
    padding-top: 0.75rem;
}

.mce-embed-summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: #666666;
    user-select: none;
}

.mce-embed-summary:hover {
    color: var(--mce-accent, #0073aa);
}

.mce-embed-body {
    margin-top: 0.6rem;
}

.mce-embed-code {
    display: block;
    width: 100%;
    box-sizing: border-box;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre;
    overflow: auto;
    min-height: 170px;
    resize: vertical;
    background: #f8f9fa;
    color: #1e1e1e;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 10px;
}

.mce-embed-code:focus {
    outline: none;
    border-color: var(--mce-accent, #0073aa);
}

/* iOS zooms the whole page when focusing any input under 16px; a
   readonly code box must not trigger that. */
@media (max-width: 480px) {
    .mce-embed-code {
        font-size: 16px;
    }
}

.mce-embed-copy {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 16px;
    font-size: 0.85rem;
    color: #ffffff;
    background-color: var(--mce-accent, #0073aa);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.mce-embed-copy:hover {
    background-color: var(--mce-accent-hover, #005a87);
}

.mce-embed-license {
    margin: 0.9rem 0 0 0;
    padding: 0.4rem 0;
    line-height: 1.5;
    font-size: 0.8rem;
    color: #777777;
}

/* ---------- Embed document only --------------------------------------- */

body.mce-embed-doc {
    margin: 0;
    padding: 12px;
    background: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
}

/* Modest h1 sharing the calculator card's max-width with auto margins so
   title and card stay aligned at any frame width. The engine caps
   .calc-wrapper at 600px. */
body.mce-embed-doc .mce-embed-title {
    max-width: 600px;
    margin: 0 auto 10px auto;
    font-size: 1.25rem;
    line-height: 1.3;
    color: #1e1e1e;
}

/* Hide the wrapper's own duplicate title heading; markup stays identical
   to the shortcode output. */
body.mce-embed-doc .calc-header .calc-title {
    display: none;
}

/* Accent variable mapping: primary button, hover, emphasized output. */
body.mce-embed-doc .calc-submit {
    background-color: var(--mce-accent, #0073aa);
}

body.mce-embed-doc .calc-submit:hover {
    background-color: var(--mce-accent-hover, #005a87);
}

body.mce-embed-doc .calc-output-value {
    color: var(--mce-accent, inherit);
}

/* In-frame handoff link under the results area. */
body.mce-embed-doc .mce-embed-handoff {
    max-width: 600px;
    margin: 10px auto 0 auto;
    font-size: 0.85rem;
    text-align: center;
}

body.mce-embed-doc .mce-embed-handoff a {
    color: var(--mce-accent, #0073aa);
    text-decoration: underline;
}

/* Dark theme (theme=dark query param). */
body.mce-embed-doc.mce-theme-dark {
    background: #1e1e1e;
}

body.mce-embed-doc.mce-theme-dark .mce-embed-title {
    color: #f0f0f0;
}

body.mce-embed-doc.mce-theme-dark .calc-wrapper {
    background: #2d2d2d;
    color: #e6e6e6;
    border-color: #3a3a3a;
}

body.mce-embed-doc.mce-theme-dark .calc-wrapper label,
body.mce-embed-doc.mce-theme-dark .calc-wrapper .calc-description,
body.mce-embed-doc.mce-theme-dark .calc-wrapper .calc-output-label,
body.mce-embed-doc.mce-theme-dark .calc-wrapper .calc-help {
    color: #cccccc;
}

body.mce-embed-doc.mce-theme-dark .calc-wrapper input,
body.mce-embed-doc.mce-theme-dark .calc-wrapper select {
    background: #1e1e1e;
    color: #e6e6e6;
    border-color: #4a4a4a;
}
