/* ── Semantic CSS variable layer + shared boilerplate (Web + WasmApp common) ──────────────
   References variables owned by this project instead of a specific UI kit's (Radzen) internal
   token names. Radzen ThemeService/server rendering only swaps the standard.css/standard-dark.css
   stylesheets themselves and knows nothing about this project's own variables — toggling
   <html>/<html class="app-dark"> (Web: App.razor server rendering, WasmApp:
   maskitTheme.setDarkClass()) makes the values below switch together with it. */
:root {
    --app-fg-primary: #242424;
    --app-fg-secondary: #424242;
    --app-fg-tertiary: #616161;
    --app-bg-secondary: #f5f5f5;
    --app-bg-tertiary: #fafafa;
    --app-bg-quaternary: #efefef;
    --app-border: #e0e0e0;
    --app-border-strong: #d1d1d1;
    --app-brand-fg: #0f6cbd;
    --app-brand-bg: #e8f1fc;
    --app-brand-bg-hover: #dbeafd;
    --app-brand-stroke: #0f6cbd;
    --app-status-success: #0e7f3d;
    --app-status-warning: #a86400;
    --app-status-danger: #c50f1f;
}

:root.app-dark {
    --app-fg-primary: #ffffff;
    --app-fg-secondary: #d6d6d6;
    --app-fg-tertiary: #adadad;
    --app-bg-secondary: #2b2b2b;
    --app-bg-tertiary: #242424;
    --app-bg-quaternary: #1f1f1f;
    --app-border: #3d3d3d;
    --app-border-strong: #4d4d4d;
    --app-brand-fg: #6cb8f6;
    --app-brand-bg: #103353;
    --app-brand-bg-hover: #14416b;
    --app-brand-stroke: #479ef5;
    --app-status-success: #6ccb5f;
    --app-status-warning: #ffc83d;
    --app-status-danger: #f1707b;
}

body {
    --body-font: "Segoe UI Variable", "Segoe UI", sans-serif;
    font-family: var(--body-font);
    color: var(--app-fg-primary);
    margin: 0;
}

/* The browser's default link color (blue / dark purple for visited links) has almost no contrast
   against a dark background and is nearly invisible — unify it to --app-brand-fg, which stays
   readable in both light and dark. */
a {
    color: var(--app-brand-fg);
}

    a:visited {
        color: var(--app-brand-fg);
    }

.body-content {
    align-self: stretch;
    height: 100%;
    display: flex;
}

.content {
    padding: 0.5rem 1.5rem;
    align-self: stretch !important;
    width: 100%;
}

footer {
    background: var(--app-bg-quaternary);
    color: var(--app-fg-primary);
    align-items: center;
    padding: 10px 10px;
}

    footer a {
        color: var(--app-fg-primary);
        text-decoration: none;
    }

        footer a:focus {
            outline: 1px dashed;
            outline-offset: 3px;
        }

        footer a:hover {
            text-decoration: underline;
        }

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    margin: 20px 0;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::before {
        content: "An error has occurred. "
    }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}


/* Cancel Radzen's fixed table layout so columns size to their content */
.rz-data-grid.rz-fit-table .rz-grid-table {
    table-layout: auto; /* Beats .rz-grid-table-fixed (0,1,0) with specificity 0,3,0 */
    width: auto;        /* Shrink-wrap the table to its content */
    min-width: 100%;    /* But never narrower than the container */
}


/* ── Rendered Markdown body (board posts · comments) ──────────────────────────────────────
   ⚠ Living here instead of scoped CSS (`BoardView.razor.css`) is intentional — this markup is
   injected as a `MarkupString`, so Blazor's scope attribute (`b-…`) isn't attached to it and
   `::deep` can't reach it. Besides, shared.css is already loaded by both hosts (WasmApp
   `index.html`, Web `Components/App.razor`).
   Colors are all `--app-*` semantic tokens, so they follow dark-theme switches automatically. */
.md-body {
    color: var(--app-fg-primary);
    line-height: 1.6;
    overflow-wrap: break-word; /* so a long URL doesn't push the card wider */
}

    /* prevents extra gaps at top/bottom from stacking with the card's own padding */
    .md-body > :first-child { margin-top: 0; }
    .md-body > :last-child { margin-bottom: 0; }

    .md-body p { margin: 0 0 0.75rem; }

    /* don't blow up h1 too much since this sits inside a card — it must not outrank the list row title (0.9rem) */
    .md-body h1, .md-body h2, .md-body h3,
    .md-body h4, .md-body h5, .md-body h6 {
        margin: 1.25rem 0 0.5rem;
        font-weight: 600;
        line-height: 1.3;
    }

    .md-body h1 { font-size: 1.35rem; }
    .md-body h2 { font-size: 1.2rem; }
    .md-body h3 { font-size: 1.08rem; }
    .md-body h4, .md-body h5, .md-body h6 { font-size: 1rem; }

    .md-body ul, .md-body ol { margin: 0 0 0.75rem; padding-left: 1.5rem; }
    .md-body li { margin: 0.15rem 0; }
    .md-body li > p { margin: 0; }

    /* Checkboxes created by UseTaskLists() — read-only, so keep the cursor as default */
    .md-body input[type="checkbox"] { margin-right: 0.35rem; cursor: default; }

    .md-body a { color: var(--app-brand-fg); }

    .md-body code {
        background: var(--app-bg-quaternary);
        color: var(--app-fg-primary); /* beats the global `code { color: #c02d76 }` */
        border-radius: 3px;
        padding: 0.1em 0.35em;
        font-size: 0.9em;
    }

    .md-body pre {
        background: var(--app-bg-quaternary);
        border: 1px solid var(--app-border);
        border-radius: 4px;
        padding: 0.6rem 0.75rem;
        margin: 0 0 0.75rem;
        overflow-x: auto; /* so a long line doesn't widen the card */
    }

        .md-body pre code { background: none; padding: 0; font-size: 0.85rem; }

    .md-body blockquote {
        margin: 0 0 0.75rem;
        padding: 0.15rem 0 0.15rem 0.75rem;
        border-left: 3px solid var(--app-border-strong);
        color: var(--app-fg-secondary);
    }

    /* UsePipeTables() — a wide table scrolls itself instead of pushing the card wider */
    .md-body table {
        display: block;
        width: max-content;
        max-width: 100%;
        overflow-x: auto;
        border-collapse: collapse;
        margin: 0 0 0.75rem;
        font-size: 0.9rem;
    }

    .md-body th, .md-body td {
        border: 1px solid var(--app-border);
        padding: 0.3rem 0.55rem;
        text-align: left;
    }

    .md-body th { background: var(--app-bg-quaternary); font-weight: 600; }

    .md-body img { max-width: 100%; height: auto; }

/* A whole manual page (Web /manual, editor /manual) rather than a board card: headings at document size
   and screenshots framed. `.md-body` stays as it is - that sizing is what the board cards need. */
/* The page's top gap is RadzenBody's padding plus .content's 0.5rem. Both bottom paddings are lost on a
   long document — .body-content is height:100% and the document overflows it — so the same sum is
   re-added here to make the gap under the last line match the gap above the title (measured: 24px each). */
.md-doc { font-size: 1rem; padding-bottom: calc(var(--rz-layout-body-padding, 1rem) + 0.5rem); }
    .md-doc h1 { font-size: 1.85rem; margin-top: 0.5rem; }
    .md-doc h2 { font-size: 1.45rem; margin-top: 2rem; padding-top: 0.75rem; border-top: 1px solid var(--app-border); }
    .md-doc h3 { font-size: 1.18rem; margin-top: 1.5rem; }
    .md-doc h4 { font-size: 1.05rem; }
    .md-doc img { border: 1px solid var(--app-border); border-radius: 4px; display: block; margin: 0.5rem 0; }
    .md-doc sub { display: block; font-size: 0.85rem; color: var(--app-fg-secondary); margin: -0.25rem 0 1rem; }
    .md-doc table { font-size: 0.95rem; }

    .md-body hr {
        border: 0;
        border-top: 1px solid var(--app-border);
        margin: 1rem 0;
    }

/* For comments — one step smaller and tighter than the post body */
.md-body-compact {
    font-size: 0.9rem;
    line-height: 1.5;
}

    .md-body-compact p,
    .md-body-compact ul,
    .md-body-compact ol,
    .md-body-compact pre,
    .md-body-compact blockquote,
    .md-body-compact table { margin-bottom: 0.4rem; }

    .md-body-compact h1, .md-body-compact h2, .md-body-compact h3,
    .md-body-compact h4, .md-body-compact h5, .md-body-compact h6 {
        margin: 0.6rem 0 0.3rem;
        font-size: 1rem;
    }
