/* Small reset kept explicit so framework changes do not alter layout. */
*,
*::before,
*::after {
  box-sizing: border-box;
  border: 0 solid currentColor;
  margin: 0;
  padding: 0;
}

html {
  background-color: var(--theme-bg, #fff);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  transition: background-color 150ms ease, color 150ms ease;
}

html *:not(img):not(video):not(svg) {
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

body { line-height: inherit; }
h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; }
a { color: inherit; text-decoration: inherit; }
b, strong { font-weight: bolder; }
code, kbd, samp, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 1em; }
small { font-size: 80%; }
sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; }
sub { bottom: -0.25em; }
sup { top: -0.5em; }
table { border-collapse: collapse; border-color: inherit; text-indent: 0; }
button, input, optgroup, select, textarea { background-color: transparent; color: inherit; font: inherit; letter-spacing: inherit; opacity: 1; }
button, select { text-transform: none; }
button, input[type="button"], input[type="reset"], input[type="submit"] { appearance: button; }
textarea { resize: vertical; }
img, svg, video, canvas, audio, iframe, embed, object { display: block; vertical-align: middle; }
img, video { height: auto; max-width: 100%; }
[hidden] { display: none !important; }
ol, ul, menu { list-style: none; }

:root {
  --theme-bg: #fff;
  --theme-text: #2a2a2a;
  --theme-accent: #d30001;
  --theme-muted: #6a6a6a;
  --theme-code-bg: #f9fafb;
  --theme-code-text: #2a2a2a;
  --theme-code-border: #9ca3af;
  --theme-heading: #000;
  --theme-blockquote-border: #1f2937;
  --theme-flash-bg: #f3f4f6;

  --admin-theme-ink: #111827;
  --admin-theme-muted: #6b7280;
  --admin-theme-line: #e5e7eb;
  --admin-theme-panel: #fff;
  --admin-theme-panel-strong: #fafafa;
  --admin-theme-shell: #f8f8f8;
  --admin-theme-accent: #111827;
  --admin-theme-accent-contrast: #fff;
  --admin-theme-accent-soft: #f3f4f6;
  --admin-theme-success: #047857;
  --admin-theme-success-soft: #ecfdf5;
  --admin-theme-danger: #b91c1c;
  --admin-theme-danger-soft: #fef2f2;
}

[data-theme="dark"] {
  --theme-bg: #1a1a1a;
  --theme-text: #e5e5e5;
  --theme-accent: #ff4444;
  --theme-muted: #999;
  --theme-code-bg: #2d2d2d;
  --theme-code-text: #e5e5e5;
  --theme-code-border: #555;
  --theme-heading: #fff;
  --theme-blockquote-border: #666;
  --theme-flash-bg: #2d2d2d;
}

html[data-admin-theme="dark"] {
  color-scheme: dark;
  --admin-theme-ink: #f5f7fb;
  --admin-theme-muted: #9ca3af;
  --admin-theme-line: #273142;
  --admin-theme-panel: #101826;
  --admin-theme-panel-strong: #172234;
  --admin-theme-shell: #0b1220;
  --admin-theme-accent: #e5ecf8;
  --admin-theme-accent-contrast: #0b1220;
  --admin-theme-accent-soft: #1e293b;
  --admin-theme-success: #34d399;
  --admin-theme-success-soft: #0f2a22;
  --admin-theme-danger: #f87171;
  --admin-theme-danger-soft: #3a1f24;
}

[data-public-root] { background: var(--theme-bg); color: var(--theme-text); }
body:has([data-admin-root]),
[data-admin-root] { background: var(--admin-theme-shell); color: var(--admin-theme-ink); font-family: "Avenir Next", "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
[data-admin-root] *, [data-admin-root] *::before, [data-admin-root] *::after { border-color: var(--admin-theme-line); }
[data-admin-root] button, [data-admin-root] input, [data-admin-root] select, [data-admin-root] textarea { font-size: 0.875rem; line-height: 1.25rem; }

[data-article] p,
[data-article] ol,
[data-article] ul,
[data-article] blockquote,
[data-article] pre,
[data-article] table,
[data-article] figure { margin-bottom: 1.25rem; }
[data-article] pre { padding: 2.5rem; line-height: 1.625; font-size: 0.875rem; overflow-x: auto; }
[data-theme="light"] [data-article] pre,
:root:not([data-theme]) [data-article] pre { color: #fff; background: #1f2937; }
[data-theme="dark"] [data-article] pre { color: #e5e7eb; background: #111827; }
[data-article] p > code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 0.875rem; padding: 0.125rem 0.5rem; background: var(--theme-code-bg); color: var(--theme-code-text); border: 1px solid var(--theme-code-border); border-radius: 0.25rem; }
[data-article] h2, [data-article] h3, [data-article] h4, [data-article] h5, [data-article] h6 { margin-bottom: 0.5rem; font-weight: 600; color: var(--theme-heading); }
[data-article] h2 { margin-top: 3rem; }
[data-article] h3 { margin-top: 2rem; }
[data-article] h4, [data-article] h5, [data-article] h6 { margin-top: 1.5rem; }
[data-article] ul { padding-left: 2rem; list-style: disc; }
[data-article] ol { padding-left: 3rem; list-style: decimal; }
[data-article] li { margin-bottom: 0; padding-left: 0.5rem; }
[data-article] blockquote { border-left: 8px solid var(--theme-blockquote-border); padding: 1rem 0 1rem 2rem; font-style: italic; }
[data-article] blockquote p:last-of-type { margin-bottom: 0; }
[data-article] a { text-decoration-line: underline; text-decoration-color: var(--theme-muted); text-underline-offset: 0.2em; }
[data-article] a:hover { color: var(--theme-accent); text-decoration-color: var(--theme-accent); }
[data-article] a:active { text-decoration-line: none; }
[data-public-main]:has(> [data-blog-post]) { max-width: none; }
[data-blog-post] > * > *, [data-blog-post] > footer { max-width: 36rem; }

@media (max-width: 639px) {
  [data-article] pre { margin-left: -2rem; margin-right: -2rem; max-width: none; }
}
@media (max-width: 1023px) {
  [data-article] p:has(> img) { margin-left: -2rem; margin-right: -2rem; max-width: none; }
  [data-article] img, [data-blog-post] > * > *, [data-blog-post] > footer { margin-left: auto; margin-right: auto; }
}

[data-rich-text] lexxy-editor { display: block; border: 0; border-radius: 0; background: transparent; }
[data-rich-text] lexxy-toolbar,
[data-rich-text] .lexxy-editor__toolbar { border: 1px solid var(--admin-theme-line); border-bottom: 0; background: var(--admin-theme-panel-strong); border-top-left-radius: 0.75rem; border-top-right-radius: 0.75rem; position: sticky; top: 1rem; z-index: 20; }
[data-rich-text] .lexxy-editor__content { min-height: 24rem; border: 1px solid var(--admin-theme-line); background: var(--admin-theme-panel); color: var(--admin-theme-ink); padding: 1rem; border-bottom-left-radius: 0.75rem; border-bottom-right-radius: 0.75rem; overflow-wrap: anywhere; }
[data-rich-text] .lexxy-editor__content a { color: #60a5fa; }
[data-rich-text] .lexxy-editor__content h1,
[data-rich-text] .lexxy-editor__content h2,
[data-rich-text] .lexxy-editor__content h3,
[data-rich-text] .lexxy-editor__content h4,
[data-rich-text] .lexxy-editor__content h5,
[data-rich-text] .lexxy-editor__content h6,
[data-rich-text] .lexxy-editor__content p,
[data-rich-text] .lexxy-editor__content li,
[data-rich-text] .lexxy-editor__content blockquote,
[data-rich-text] .lexxy-editor__content strong,
[data-rich-text] .lexxy-editor__content em { color: inherit; }
[data-rich-text] .lexxy-editor__content code,
[data-rich-text] .lexxy-editor__content pre { color: var(--admin-theme-ink); }
[data-rich-text] .lexxy-editor__content pre { background: var(--admin-theme-panel-strong); }
[data-rich-text] lexxy-toolbar button,
[data-rich-text] lexxy-toolbar summary,
[data-rich-text] .lexxy-editor__toolbar .lexxy-editor__toolbar-button,
[data-rich-text] lexxy-toolbar svg,
[data-rich-text] .lexxy-editor__toolbar button,
[data-rich-text] .lexxy-editor__toolbar svg { color: var(--admin-theme-ink); }
[data-rich-text] lexxy-toolbar button,
[data-rich-text] lexxy-toolbar summary,
[data-rich-text] .lexxy-editor__toolbar .lexxy-editor__toolbar-button { background: transparent; border-color: transparent; }
[data-rich-text] lexxy-toolbar button:hover,
[data-rich-text] lexxy-toolbar summary:hover,
[data-rich-text] .lexxy-editor__toolbar .lexxy-editor__toolbar-button:hover { background: var(--admin-theme-panel); }
[data-rich-text] lexxy-toolbar button[aria-pressed="true"],
[data-rich-text] lexxy-toolbar button[aria-expanded="true"],
[data-rich-text] lexxy-toolbar details[open] > summary,
[data-rich-text] .lexxy-editor__toolbar .lexxy-editor__toolbar-button[aria-pressed="true"] { background: var(--admin-theme-accent-soft); color: var(--admin-theme-ink); }
[data-rich-text] .lexxy-editor__content action-text-attachment,
[data-rich-text] .lexxy-editor__content .attachment,
[data-rich-text] .lexxy-editor__content figure { display: block; max-width: 100%; }
[data-rich-text] .lexxy-editor__content figure.attachment { margin: 1.5rem auto; width: fit-content; }
[data-rich-text] .lexxy-editor__content figure.attachment:has(.attachment__caption textarea:placeholder-shown) { width: min(100%, 42rem); }
[data-rich-text] .lexxy-editor__content img { display: block; width: auto; max-width: min(100%, 42rem); height: auto; margin-inline: auto; border-radius: 0.5rem; }
[data-rich-text] .lexxy-editor__content .attachment__caption { margin-top: 0.5rem; inline-size: 100%; overflow-wrap: anywhere; font-size: 0.75rem; color: var(--admin-theme-muted); text-align: center; }
[data-rich-text] .lexxy-editor__content .attachment__caption textarea { min-inline-size: 0; inline-size: 100%; max-inline-size: 100%; border-radius: 0.375rem; background: var(--admin-theme-panel-strong); color: var(--admin-theme-ink); overflow-wrap: anywhere; }
[data-rich-text] .lexxy-editor__content .attachment__caption textarea::placeholder { color: var(--admin-theme-muted); opacity: 1; }
[data-rich-text] .lexxy-editor__content .attachment__caption textarea:placeholder-shown { white-space: normal; text-overflow: clip; }
@supports (field-sizing: content) { [data-rich-text] .lexxy-editor__content .attachment__caption textarea { field-sizing: fixed; } }
