/**
 * Fieldnotes design system — Bootstrap 6 token overrides.
 *
 * Bootstrap is vendored unchanged. Change colors here and in theme.json;
 * theme.json supplies the matching palettes in WordPress's editor controls.
 * Both :root and .editor-styles-wrapper receive the same token values.
 */

:root,
.editor-styles-wrapper {
    color-scheme: light;

    /* Brand colors follow the palette chosen in WordPress Global Styles. */
    --jm-paper: var(--wp--preset--color--paper, #f7f5ef);
    --jm-ink: var(--wp--preset--color--ink, #222924);
    --jm-teal: var(--wp--preset--color--teal, #164e48);
    --jm-muted: var(--wp--preset--color--muted, #526059);
    --jm-line: #d4d7ce;

    /* Bootstrap 6 global surface and typography tokens. */
    --bs-bg-body: var(--jm-paper);
    --bs-bg-1: var(--jm-paper);
    --bs-bg-2: var(--wp--preset--color--sage, #e8eee7);
    --bs-fg-body: var(--jm-ink);
    --bs-fg-1: var(--jm-ink);
    --bs-fg-2: var(--jm-muted);
    --bs-border-color: var(--jm-line);
    --bs-body-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --bs-body-font-size: 1.1875rem;
    --bs-body-line-height: 1.75;
    --bs-link-color: var(--jm-teal);
    --bs-link-hover-color: var(--jm-teal);

    /* Bootstrap 6 primary semantic theme, shared by buttons and components. */
    --bs-primary-base: var(--jm-teal);
    --bs-primary-bg: var(--jm-teal);
    --bs-primary-fg: var(--jm-teal);
    --bs-primary-fg-emphasis: var(--jm-ink);
    --bs-primary-bg-subtle: var(--wp--preset--color--sage, #e8eee7);
    --bs-primary-border: var(--jm-teal);
    --bs-primary-contrast: var(--jm-paper);
    --bs-primary-focus-ring: #a56221;
}

/* Surfaces used by both the editorial layout and technical content. */
:root,
.editor-styles-wrapper {
    --jm-surface: var(--wp--preset--color--sage, #e8eee7);
    --jm-code-bg: #eef1ed;
    --jm-code-fg: #21332a;
    --jm-line-strong: #c8d1c7;
    --jm-focus: #a56221;
    --jm-control-accent: #164e48;
}

/* Override the shared palette, rather than inverting images or entire pages. */
:root[data-bs-theme="dark"] {
    color-scheme: dark;
    --wp--preset--color--paper: #151d1b;
    --wp--preset--color--ink: #e5eee8;
    --wp--preset--color--teal: #8cd0be;
    --wp--preset--color--muted: #b4c4bc;
    --wp--preset--color--sage: #20312b;
    --wp--preset--color--gold: #d5b77a;
    --jm-line: #3b5047;
    --jm-code-bg: #1b2a24;
    --jm-code-fg: #e4eee7;
    --jm-line-strong: #4d6559;
    --jm-focus: #edc782;
    --jm-control-accent: #a9ddd2;
}

/* With JavaScript disabled, still respect the operating system's dark mode. */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme="light"]):not([data-bs-theme="dark"]) {
        color-scheme: dark;
        --wp--preset--color--paper: #151d1b;
        --wp--preset--color--ink: #e5eee8;
        --wp--preset--color--teal: #8cd0be;
        --wp--preset--color--muted: #b4c4bc;
        --wp--preset--color--sage: #20312b;
        --wp--preset--color--gold: #d5b77a;
        --jm-line: #3b5047;
        --jm-code-bg: #1b2a24;
        --jm-code-fg: #e4eee7;
        --jm-line-strong: #4d6559;
        --jm-focus: #edc782;
        --jm-control-accent: #a9ddd2;
    }
}
