/* Reset, typography, focus, scrollbars and reduced motion. Components style themselves (*.razor.css). */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    background: var(--ci-bg);
    /* Elements scrolled into view (keyboard focus, anchors, automation) stay clear of the sticky top bar and the sticky
       save bar at the bottom of edit pages (WCAG 2.4.11 Focus Not Obscured). */
    scroll-padding-top: calc(var(--ci-topbar-h) + 12px);
    scroll-padding-bottom: 104px;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--ci-bg);
    color: var(--ci-text);
    font-family: var(--ci-font-ui);
    font-size: var(--ci-text-base);
    line-height: 1.5;
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol, pre { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

h1, h2, h3, h4 { color: var(--ci-text-strong); font-weight: 600; line-height: 1.25; }
h1 { font-family: var(--ci-font-display); font-size: var(--ci-text-h1); letter-spacing: -0.02em; }
h2 { font-size: var(--ci-text-lg); }
h3 { font-size: var(--ci-text-base); }
h4 { font-size: var(--ci-text-md); }
h1:focus { outline: none; }

a { color: var(--ci-accent-text); text-decoration: none; text-underline-offset: 3px; }
a:hover { color: var(--ci-accent-hover); text-decoration: underline; }

img, svg, video { display: block; max-width: 100%; }
svg { flex: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
table { border-collapse: collapse; }
hr { border: 0; border-top: 1px solid var(--ci-border); margin: var(--ci-space-4) 0; }

code, kbd, samp, pre { font-family: var(--ci-font-mono); font-size: 0.92em; }
:not(pre) > code {
    padding: 1px 5px;
    border-radius: 5px;
    background: var(--ci-surface-2);
    border: 1px solid var(--ci-border);
    overflow-wrap: anywhere;
}
mark { background: var(--ci-mark-bg); color: var(--ci-mark-text); border-radius: 3px; padding: 0 1px; }
::selection { background: color-mix(in srgb, var(--ci-accent) 32%, transparent); }

/* Focus: always visible for keyboard users. */
:focus-visible { outline: 2px solid var(--ci-accent); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--ci-scrollbar) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ci-scrollbar); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* Motion: only the running-job pulse, progress stripes and small hover transitions. */
@keyframes ci-pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ci-info) 55%, transparent); }
    70% { box-shadow: 0 0 0 7px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes ci-stripe { from { background-position: 0 0; } to { background-position: 28px 0; } }
@keyframes ci-indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@keyframes ci-shimmer { 0% { background-position: -320px 0; } 100% { background-position: 320px 0; } }
/* A field opened from the global search (ci.palette.focusWhenReady): briefly outlined so the eye finds it. */
.ci-field-flash { border-radius: var(--ci-radius-sm); animation: ci-field-flash 1.8s var(--ci-ease) 1; }
@keyframes ci-field-flash {
    0%, 60% { box-shadow: 0 0 0 3px var(--ci-accent-soft), 0 0 0 1px var(--ci-accent); }
    100% { box-shadow: 0 0 0 3px transparent, 0 0 0 1px transparent; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Native dialogs (Dialog / Drawer components) */
dialog { color: inherit; }
dialog::backdrop { background: var(--ci-scrim); }

/* Blazor circuit error banner (made visible by blazor.web.js) */
#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 16px 16px 16px;
    z-index: 2000;
    padding: 12px 16px;
    border-radius: var(--ci-radius-md);
    background: var(--ci-warning-soft);
    border: 1px solid var(--ci-warning-strong-border);
    color: var(--ci-warning-text);
    box-shadow: var(--ci-shadow-overlay);
}
#blazor-error-ui .reload { margin-inline-start: 12px; color: inherit; font-weight: 600; text-decoration: underline; }
#blazor-error-ui .dismiss { float: inline-end; border: 0; background: transparent; color: inherit; font-size: 1rem; }

/* Validation messages of the static SSR forms */
.validation-message { color: var(--ci-error-text); font-size: var(--ci-text-sm); }
