/* deliberately plain: anything more decorative would compete with the manager these pages embed */

:root {
    color-scheme: light dark;

    --page-width: 68rem;
    --space: 1rem;

    --background: #fff;
    --text: #1a1a1a;
    --text-muted: #5a5a5a;
    --rule: #d8d8d8;
    --accent: #0b5fff;

    --code-background: #f6f7f9;
    --code-rule: #dcdfe4;

    --notice-background: #fdf6e3;
    --notice-rule: #c9a227;
    --notice-text: #5c4a00;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #17191c;
        --text: #e6e8ea;
        --text-muted: #a0a5ab;
        --rule: #33373d;
        --accent: #6ea0ff;

        --code-background: #1e2126;
        --code-rule: #33373d;

        --notice-background: #2b2513;
        --notice-rule: #8a7320;
        --notice-text: #e8d9a0;
    }
}

body {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: calc(var(--space) * 2) var(--space) calc(var(--space) * 4);
    background: var(--background);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

h1,
h2,
h3 {
    line-height: 1.25;
    font-weight: 600;
}

h1 {
    margin: 0 0 calc(var(--space) / 2);
    font-size: 1.9rem;
}

/* a rule above every section, so the page reads as a sequence of blocks rather than a wall */
h2 {
    margin: calc(var(--space) * 2.5) 0 var(--space);
    padding-top: calc(var(--space) / 2);
    border-top: 1px solid var(--rule);
    font-size: 1.25rem;
}

h3 {
    margin: calc(var(--space) * 1.5) 0 calc(var(--space) / 2);
    font-size: 1.05rem;
}

p {
    margin: 0 0 var(--space);
    max-width: 76ch;
}

a {
    color: var(--accent);
}

.lead {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* code ------------------------------------------------------------------------------------- */

code,
kbd,
pre {
    font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.875em;
}

/* inline code stays inside the line, so no border - only a tint to separate it from prose */
:not(pre) > code {
    padding: 0.1em 0.35em;
    background: var(--code-background);
    border-radius: 0.2em;
}

pre {
    margin: 0 0 var(--space);
    padding: calc(var(--space) * 0.75) var(--space);
    background: var(--code-background);
    border: 1px solid var(--code-rule);
    border-radius: 0.3em;
    /* samples are copied and pasted, so they must not be reflowed to fit */
    overflow-x: auto;
    line-height: 1.5;
}

pre code {
    padding: 0;
    background: none;
}

/* lists ------------------------------------------------------------------------------------ */

ul {
    margin: 0 0 var(--space);
    padding-left: 1.3em;
    max-width: 76ch;
}

li {
    margin-bottom: 0.35em;
}

/* the demo index reads as a catalogue: the link is the item, the rest explains it */
.catalogue {
    list-style: none;
    padding-left: 0;
    max-width: none;
}

.catalogue li {
    padding: 0.45em 0;
    border-bottom: 1px solid var(--rule);
}

/* only the item's own link forms the column; a link inside the description must not be padded out */
.catalogue > li > a:first-child {
    display: inline-block;
    min-width: 12rem;
    font-weight: 600;
}

.catalogue span {
    color: var(--text-muted);
}

/* the notice shown on every page that embeds a writable manager */
.demo-notice {
    max-width: 76ch;
    margin-bottom: calc(var(--space) * 1.5);
    padding: 0.6em 0.8em;
    background: var(--notice-background);
    border: 1px solid var(--notice-rule);
    border-radius: 0.3em;
    color: var(--notice-text);
}

iframe {
    border: 1px solid var(--rule);
    border-radius: 0.3em;
    background: var(--background);
}

@media (max-width: 40rem) {
    .catalogue a {
        display: block;
        min-width: 0;
    }
}
