/* SPDX-License-Identifier: Apache-2.0 */
/*
 * The shared look of the examples, optional: every page links it before its
 * own style.css, and a page copied without it falls back to the browser
 * defaults. The colours, the font stacks, the type steps, the spacing, the
 * radius and the measure are those of the awaforge site (apps/awaforge/assets/
 * tokens.css, copied as data); a test in apps/awaforge pins the parity, so the
 * two cannot drift apart silently. The on-accent and error colours have no
 * awaforge counterpart and are the sheet's own. Dark by default, light under
 * the light preference. It styles plain elements only, so no example's markup
 * depends on it.
 */
:root {
    color-scheme: dark light;
    --ex-bg: #0f1720;
    --ex-fg: #e6edf3;
    --ex-muted: #9fb3c8;
    --ex-accent: #b3dfef;
    --ex-on-accent: #00263d;
    --ex-border: #22364a;
    --ex-surface: #16222e;
    --ex-code-bg: #00263d;
    --ex-code-fg: #e6edf3;
    --ex-error: #ffb4ab;
    --ex-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --ex-mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
    --ex-step--1: 0.875rem;
    --ex-step-0: 1rem;
    --ex-step-2: 1.375rem;
    --ex-step-3: 1.75rem;
    --ex-step-4: 2.25rem;
    --ex-space-1: 0.25rem;
    --ex-space-2: 0.5rem;
    --ex-space-3: 0.75rem;
    --ex-space-4: 1rem;
    --ex-space-6: 1.5rem;
    --ex-space-8: 2rem;
    --ex-radius: 0.375rem;
    --ex-measure: 44rem;
}
@media (prefers-color-scheme: light) {
    :root {
        --ex-bg: #ffffff;
        --ex-fg: #212529;
        --ex-muted: #003462;
        --ex-accent: #0078b3;
        --ex-on-accent: #ffffff;
        --ex-border: #d5e6ee;
        --ex-surface: #f4f9fc;
        --ex-code-bg: #eef6fa;
        --ex-code-fg: #00263d;
        --ex-error: #b3261e;
    }
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--ex-bg); color: var(--ex-fg); font: var(--ex-step-0)/1.65 var(--ex-sans); -webkit-font-smoothing: antialiased; }
main { max-width: var(--ex-measure); margin-inline: auto; padding: var(--ex-space-6) var(--ex-space-4) var(--ex-space-8); }
/* an office page's legal notices, after <main>: quieter, same measure */
footer {
    max-width: var(--ex-measure); margin-inline: auto; padding: var(--ex-space-4); border-top: 1px solid var(--ex-border);
    color: var(--ex-muted); font-size: var(--ex-step--1);
}
h1, h2, h3 { text-wrap: balance; }
h1 { font-size: var(--ex-step-4); letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 var(--ex-space-4); }
h2 { font-size: var(--ex-step-3); letter-spacing: -0.015em; line-height: 1.2; margin: var(--ex-space-8) 0 var(--ex-space-4); }
h3 { font-size: var(--ex-step-2); line-height: 1.3; margin: var(--ex-space-6) 0 var(--ex-space-3); }
p, ul, ol, form, section, fieldset { margin: 0 0 var(--ex-space-3); }
ul, ol { padding-inline-start: var(--ex-space-6); }
a { color: var(--ex-accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
label { font-weight: 600; }

/* values: code, results and long keys or hashes wrap instead of widening the page */
code, kbd, pre, output, samp { font-family: var(--ex-mono); font-size: var(--ex-step--1); }
code, kbd { background: var(--ex-code-bg); color: var(--ex-code-fg); padding: 0.1em 0.35em; border-radius: 0.125rem; }
pre code, pre kbd { background: none; padding: 0; }
pre {
    background: var(--ex-code-bg); color: var(--ex-code-fg); padding: var(--ex-space-4); border: 1px solid var(--ex-border);
    border-left: 3px solid var(--ex-accent); border-radius: var(--ex-radius); line-height: 1.6; tab-size: 4; white-space: pre-wrap;
}
code, pre, output, samp, dd, td, li { overflow-wrap: anywhere; }

/* form controls */
input, textarea, select, button { font: inherit; color: inherit; max-width: 100%; }
input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"]), textarea, select {
    background: var(--ex-surface); border: 1px solid var(--ex-muted); border-radius: var(--ex-radius);
    padding: var(--ex-space-1) var(--ex-space-2);
}
/* the native list of a select does not follow the page: give its options their own colours */
option { background-color: var(--ex-surface); color: var(--ex-fg); }
textarea { display: block; width: 100%; min-height: 6rem; margin-block: var(--ex-space-1) var(--ex-space-3); }
button {
    background: var(--ex-accent); color: var(--ex-on-accent); border: 1px solid var(--ex-accent); border-radius: var(--ex-radius);
    padding: var(--ex-space-1) var(--ex-space-3); margin: var(--ex-space-1) var(--ex-space-1) var(--ex-space-1) 0; cursor: pointer;
}
button:disabled { opacity: 0.55; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--ex-accent); outline-offset: 2px; border-radius: 0.125rem; }

/* results */
table { border-collapse: collapse; width: 100%; margin: var(--ex-space-3) 0; font-size: var(--ex-step--1); }
caption { text-align: start; color: var(--ex-muted); padding-block-end: var(--ex-space-1); }
th, td { border: 1px solid var(--ex-border); padding: var(--ex-space-1) var(--ex-space-2); text-align: start; vertical-align: top; }
th { background: var(--ex-surface); color: var(--ex-muted); font-weight: 600; }
dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--ex-space-1) var(--ex-space-4); margin: var(--ex-space-3) 0; }
dt { color: var(--ex-muted); }
dd { margin: 0; min-width: 0; }
@media (max-width: 36rem) {
    dl { grid-template-columns: minmax(0, 1fr); }
    dd { padding-inline-start: var(--ex-space-3); margin-block-end: var(--ex-space-2); }
}
.error { color: var(--ex-error); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
/* last: a component rule setting `display` must never outrank `hidden` */
[hidden] { display: none !important; }
