/**
 * Block editor canvas styles — match the live De Halm frontend.
 * Loaded via enqueue_block_assets (iframe) + enqueue_block_editor_assets (title chrome).
 */

:root,
.editor-styles-wrapper,
.block-editor-block-list__layout,
.edit-post-visual-editor,
.editor-visual-editor {
    --dehalm-green: #2d6a4f;
    --dehalm-green-dark: #1b4332;
    --dehalm-green-light: #40916c;
    --dehalm-text: #2c2c2c;
    --dehalm-text-muted: #5c5c5c;
    --dehalm-border: #e8e4de;
    --dehalm-cream: #faf8f5;
    --dehalm-white: #ffffff;
    --dehalm-radius: 10px;
    --dehalm-radius-lg: 16px;
    --dehalm-shadow: 0 4px 24px rgba(27, 67, 50, 0.08);
    --dehalm-font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
    --dehalm-font-serif: 'Libre Baskerville', Georgia, serif;
}

/* ── Page title (H1) in the editor — matches .dehalm-article__title ── */
.editor-post-title__input,
.editor-post-title__block .editor-post-title__input,
.edit-post-visual-editor__post-title-wrapper .editor-post-title__input,
.editor-visual-editor__post-title-wrapper .editor-post-title__input,
.wp-block-post-title,
.editor-styles-wrapper .wp-block-post-title,
h1.wp-block-post-title,
.editor-styles-wrapper h1.editor-post-title,
.editor-styles-wrapper .editor-post-title {
    font-family: var(--dehalm-font-serif) !important;
    font-size: clamp(1.75rem, 4vw, 2.5rem) !important;
    font-weight: 600 !important;
    color: var(--dehalm-green-dark) !important;
    line-height: 1.25 !important;
    text-align: left !important;
    margin: 0 0 2rem !important;
    padding: 0 !important;
}

.edit-post-visual-editor__post-title-wrapper,
.editor-visual-editor__post-title-wrapper,
.editor-styles-wrapper .edit-post-visual-editor__post-title-wrapper {
    margin-inline: 0 !important;
    padding-inline: 0 !important;
    text-align: left !important;
}

/* ── Canvas: left-aligned like live .dehalm-container ── */
.editor-styles-wrapper,
.block-editor-block-list__layout {
    font-family: var(--dehalm-font-sans);
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--dehalm-text);
    background: var(--dehalm-cream);
    text-align: left !important;
}

.editor-styles-wrapper {
    max-width: 1140px;
    margin-inline: auto;
    padding: 1.5rem;
}

/* Stop Gutenberg from centering root blocks */
.editor-styles-wrapper .is-root-container > .wp-block,
.editor-styles-wrapper .block-editor-block-list__layout > .wp-block,
.editor-styles-wrapper .is-root-container > [data-block] {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: none !important;
}

.editor-styles-wrapper .wp-block,
.editor-styles-wrapper p,
.editor-styles-wrapper .wp-block-paragraph,
.editor-styles-wrapper h1,
.editor-styles-wrapper h2,
.editor-styles-wrapper h3,
.editor-styles-wrapper h4,
.editor-styles-wrapper .wp-block-heading,
.editor-styles-wrapper .wp-block-list,
.editor-styles-wrapper ul,
.editor-styles-wrapper ol,
.editor-styles-wrapper li,
.editor-styles-wrapper .wp-block-buttons,
.editor-styles-wrapper .dehalm-intro,
.editor-styles-wrapper .dehalm-card,
.editor-styles-wrapper .dehalm-card-body,
.editor-styles-wrapper .has-text-align-center,
.editor-styles-wrapper .has-text-align-right {
    text-align: left !important;
}

.editor-styles-wrapper .wp-block-buttons {
    justify-content: flex-start !important;
}

.editor-styles-wrapper p,
.editor-styles-wrapper .wp-block-paragraph {
    font-family: var(--dehalm-font-sans) !important;
    font-size: 1.0625rem !important;
    line-height: 1.65 !important;
    color: var(--dehalm-text) !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.editor-styles-wrapper h2,
.editor-styles-wrapper h3,
.editor-styles-wrapper .wp-block-heading {
    font-family: var(--dehalm-font-serif) !important;
    font-weight: 600 !important;
    color: var(--dehalm-green-dark) !important;
    line-height: 1.3;
    text-align: left !important;
}

.editor-styles-wrapper h3 {
    color: var(--dehalm-green) !important;
}

/* Green pill buttons — same as live */
.editor-styles-wrapper .wp-block-button__link,
.editor-styles-wrapper .wp-element-button,
.block-editor-block-list__layout .wp-block-button__link {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-family: var(--dehalm-font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--dehalm-white) !important;
    background: var(--dehalm-green) !important;
    border: none !important;
    border-radius: 999px !important;
    text-decoration: none !important;
    box-shadow: none;
}

.editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link,
.block-editor-block-list__layout .wp-block-button.is-style-outline .wp-block-button__link {
    color: var(--dehalm-green) !important;
    background: transparent !important;
    border: 2px solid var(--dehalm-green) !important;
}

/* Cards */
.editor-styles-wrapper .dehalm-cards,
.block-editor-block-list__layout .dehalm-cards {
    gap: 1.5rem !important;
}

.editor-styles-wrapper .dehalm-card,
.block-editor-block-list__layout .dehalm-card {
    background: var(--dehalm-white);
    border-radius: var(--dehalm-radius-lg);
    border: 1px solid var(--dehalm-border);
    box-shadow: var(--dehalm-shadow);
    overflow: hidden;
}

.editor-styles-wrapper .dehalm-card-image img,
.editor-styles-wrapper .dehalm-card .wp-block-image img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 0;
}

.editor-styles-wrapper .dehalm-card-body {
    padding: 1rem 1.25rem 1.25rem;
}

.editor-styles-wrapper .dehalm-card-body .wp-block-heading {
    margin-top: 0;
}
