/* Custom styles of the website, maintained by hand. Loaded after tailwind.css.
   Colors, fonts and radii from the CadenceMaps design system. The rules lie in the Tailwind
   layers base and components, so Tailwind classes in the HTML can override them. */

/* ───────── Colors: light by default, dark follows the system setting ───────── */
:root {
    color-scheme: light dark;
    --type-display: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
    --type-sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
    --type-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

    --paper: #f5f7f5;
    --paper-raised: #ffffff;
    --paper-sunken: #eceeec;
    --line: #d8ddd9;
    --line-strong: #7f8a85;
    --ink: #14201c;
    --ink-muted: #505d57;
    --lake: #1b5da6;
    --lake-strong: #144a86;
    --lake-soft: #e3edf8;
    --on-lake: #ffffff;
    --contour: #934c12;
    --contour-soft: #f6e8da;
    --amber: #7d5100;
    --amber-soft: #fbefd7;
    --signal: #ad271f;
    --signal-soft: #fbe5e2;
    --forest: #2c6a39;
    --code-bg: #16211d;
    --code-bar: #1e2b26;
    --code-line: #2d3b35;
    --code-fg: #e2e9e5;
    --code-muted: #93a29c;
    --code-string: #a3d495;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #0f1513;
        --paper-raised: #161e1b;
        --paper-sunken: #0a0f0d;
        --line: #27312d;
        --line-strong: #66736d;
        --ink: #e6ece9;
        --ink-muted: #9ba8a2;
        --lake: #7db1ee;
        --lake-strong: #a6c9f4;
        --lake-soft: #14263a;
        --on-lake: #0b1622;
        --contour: #e59d5e;
        --contour-soft: #2c2016;
        --amber: #e6b651;
        --amber-soft: #2d2410;
        --signal: #f28b82;
        --signal-soft: #3a1714;
        --forest: #7cc58a;
        --code-bg: #0b110f;
        --code-bar: #141c19;
        --code-line: #27312d;
        --code-muted: #8d9c96;
    }
}

@layer base {
    html {
        scroll-padding-top: 5rem;
    }

    body {
        background: var(--paper);
        color: var(--ink);
        font-family: var(--type-sans), serif;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    h1, h2, h3 {
        font-family: var(--type-display), serif;
        text-wrap: balance;
    }

    :where(a, button, summary, pre):focus-visible {
        outline: 2px solid var(--lake);
        outline-offset: 2px;
    }
}

@layer components {
    .prose-cm {
        max-width: 78ch;
        line-height: 1.625;
    }

    .prose-cm > * + * {
        margin-top: 16px;
    }

    .prose-cm h2 {
        padding-top: 32px;
        font-size: 24px;
        line-height: 32px;
        font-weight: 600;
    }

    @media (width >= 640px) {
        .prose-cm h2 {
            font-size: 28px;
        }
    }
    .prose-cm h3 {
        padding-top: 8px;
        font-size: 18px;
        line-height: 28px;
        font-weight: 600;
    }

    .prose-cm a {
        color: var(--lake);
        text-decoration: underline;
        text-underline-offset: 2px;
    }

    .prose-cm a:hover {
        color: var(--lake-strong);
    }

    .prose-cm ol {
        list-style: decimal;
        padding-left: 24px;
    }

    .prose-cm ol > li + li {
        margin-top: 8px;
    }

    .prose-cm ol ::marker {
        color: var(--contour);
    }

    .prose-cm ul {
        list-style: disc;
        padding-left: 24px;
    }

    .prose-cm ul > li + li {
        margin-top: 4px;
    }

    .prose-cm ul ::marker {
        color: var(--ink-muted);
    }

    .prose-cm :not(pre) > code {
        padding: 0 4px;
        border: 1px solid var(--line);
        border-radius: 2px;
        background: var(--paper-sunken);
        font-family: var(--type-mono);
        font-size: 0.875em;
    }

    /* Label line above headings, like an axis label */
    .eyebrow {
        display: flex;
        align-items: center;
        gap: 8px;
        color: var(--contour);
        font: 500 12px/16px var(--type-mono);
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .eyebrow::before {
        content: "";
        width: 16px;
        height: 1px;
        background: currentColor;
    }

    /* Code block and single command, dark in both themes. Copy with <button class="copy" data-copy>. */
    .code {
        position: relative;
        overflow: hidden;
        border: 1px solid var(--code-line);
        border-radius: 4px;
        background: var(--code-bg);
        color: var(--code-fg);
    }

    .code pre {
        overflow-x: auto;
        padding: 16px 56px 16px 16px;
        font: 400 14px/22px var(--type-mono);
    }

    .code .copy {
        position: absolute;
        top: 8px;
        right: 8px;
        display: grid;
        place-items: center;
        width: 36px;
        height: 36px;
        border-radius: 4px;
        color: var(--code-muted);
        cursor: pointer;
    }

    .code .copy:hover {
        background: var(--code-bar);
        color: var(--code-fg);
    }

    .code .copy[data-done] {
        color: var(--code-string);
    }

    .code [data-prompt]::before {
        content: "$ ";
        color: var(--code-muted);
        user-select: none;
    }

    .note {
        max-width: 78ch;
        padding: 16px;
        border-radius: 4px;
        background: var(--lake-soft);
        font-size: 14px;
        line-height: 1.625;
    }

    .note strong:first-child {
        display: block;
        margin-bottom: 4px;
        color: var(--lake);
    }

    .note-warning {
        background: var(--amber-soft);
    }

    .note-warning strong:first-child {
        color: var(--amber);
    }

    .note-important {
        background: var(--signal-soft);
    }

    .note-important strong:first-child {
        color: var(--signal);
    }

    /* Table, scrolls inside the surrounding overflow-x-auto */
    .table-cm {
        width: 100%;
        border-collapse: collapse;
        font-size: 14px;
        line-height: 20px;
    }

    .table-cm th {
        padding: 8px 12px;
        background: var(--paper-sunken);
        color: var(--ink-muted);
        text-align: left;
        font: 500 12px/16px var(--type-mono);
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }

    .table-cm td {
        padding: 8px 12px;
        border-top: 1px solid var(--line);
        vertical-align: top;
    }
}
