/* ============================================================================
   base.css — reset, root typography, and the app-shell layout primitives.
   ============================================================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--sc-font-body);
    font-weight: var(--sc-fw-light);
    font-size: var(--sc-fs-body);
    line-height: var(--sc-lh-body);
    color: var(--sc-text);
    background: var(--sc-bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Theme change should feel intentional, not jarring. */
body, .sc-card, .sc-nav, .sc-topbar, .sc-bottomnav {
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

h1, h2, h3, h4 { font-family: var(--sc-font-heading); font-weight: var(--sc-fw-semibold); line-height: var(--sc-lh-tight); margin: 0 0 var(--sc-space-3); }
h1 { font-size: var(--sc-fs-h1); }
h2 { font-size: var(--sc-fs-h2); }
h3 { font-size: var(--sc-fs-h3); }

p { margin: 0 0 var(--sc-space-4); }

a { color: var(--sc-accent); text-decoration: none; }
a:hover { color: var(--sc-accent-hover); text-decoration: underline; }

:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--sc-focus-ring); border-radius: var(--sc-radius-sm); }

/* Blazor's FocusOnNavigate moves focus to the routed <h1> (giving it
   tabindex="-1") for screen readers. That programmatic focus must not render a
   visible ring — only genuine keyboard focus on interactive controls should. */
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible { outline: none; box-shadow: none; }

img, svg, video { max-width: 100%; height: auto; display: block; }

/* --- App shell: header / content / (mobile) bottom nav --- */
.sc-app {
    min-height: 100dvh;
    display: grid;
    grid-template-rows: auto 1fr;
}

.sc-app__main { min-width: 0; }

.sc-container {
    width: 100%;
    max-width: var(--sc-container-max);
    margin-inline: auto;
    padding-inline: clamp(var(--sc-space-4), 4vw, var(--sc-space-6));
}

.sc-section { padding-block: var(--sc-space-6); }

/* --- Layout helpers --- */
.sc-stack { display: flex; flex-direction: column; gap: var(--sc-space-4); }
.sc-cluster { display: flex; flex-wrap: wrap; gap: var(--sc-space-3); align-items: center; }

.sc-grid {
    display: grid;
    gap: var(--sc-space-5);
    grid-template-columns: repeat(var(--sc-cols, 1), minmax(0, 1fr));
}

.sc-text-muted { color: var(--sc-text-muted); }
.sc-display { font-family: var(--sc-font-heading); font-weight: var(--sc-fw-extrabold); font-size: var(--sc-fs-display); line-height: var(--sc-lh-tight); }
.sc-subheading { font-family: var(--sc-font-subheading); font-weight: var(--sc-fw-regular); }
.sc-condensed { font-family: var(--sc-font-condensed); }

/* On tablet+ the shell gains a bottom padding reset (bottom nav hidden) */
@media (min-width: 768px) {
    .sc-app { padding-bottom: 0; }
}

/* Blazor unhandled-error UI — hidden by default; the framework toggles display:block. */
#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: var(--sc-z-toast);
    padding: var(--sc-space-3) var(--sc-space-5);
    background: var(--sc-surface);
    color: var(--sc-text);
    border-top: 2px solid var(--sc-danger);
    box-shadow: 0 -2px 12px var(--sc-shadow);
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: var(--sc-space-4); top: var(--sc-space-3); }
#blazor-error-ui a { color: var(--sc-accent); }
