/* Base: page, type scale, links, focus, forms. Uses tokens.css only. */

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--g-font);
    font-size: var(--g-text-md);
    line-height: var(--g-leading);
    color: var(--g-color-text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* One type scale. Page title = h1; CMS content inherits the font. */
h1, .h1 { font-size: var(--g-text-3xl); font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
h2, .h2 { font-size: var(--g-text-2xl); font-weight: 650; line-height: 1.25; }
h3, .h3 { font-size: var(--g-text-xl); font-weight: 650; line-height: 1.3; }
h4, .h4 { font-size: var(--g-text-lg); font-weight: 600; line-height: 1.35; }
h5, .h5 { font-size: var(--g-text-md); font-weight: 600; line-height: 1.4; }
h6, .h6 { font-size: var(--g-text-sm); font-weight: 600; line-height: 1.4; }

@media (max-width: 575.98px) {
    h1, .h1 { font-size: 1.75rem; }
    h2, .h2 { font-size: 1.375rem; }
}

/* Keyboard focus is always visible. */
:focus-visible {
    outline: 3px solid rgba(var(--g-color-primary-rgb), 0.55);
    outline-offset: 2px;
}

/* Skip link: first focusable element, visible only when focused. */
.skip-link {
    position: absolute;
    left: var(--g-space-2);
    top: -3rem;
    z-index: 1100;
    padding: var(--g-space-2) var(--g-space-4);
    background: var(--g-color-surface);
    border: 2px solid var(--g-color-primary);
    border-radius: var(--g-radius-sm);
}

    .skip-link:focus {
        top: var(--g-space-2);
    }

/* Phones: inputs under 16px make iOS Safari zoom in on focus. */
@media (max-width: 767.98px) {
    html body input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
    html body select,
    html body textarea {
        font-size: 16px;
    }
}

/* Buttons and inputs: comfortable targets. */
.btn {
    font-weight: 600;
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--g-space-2);
}

    .btn.btn-sm {
        min-height: 2rem;
    }

@media (max-width: 767.98px) {
    .btn:not(.btn-sm):not(.btn-link) {
        min-height: var(--g-tap);
    }
}

/* Form validation (Blazor EditForm classes). */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--g-color-success);
}

.invalid {
    outline: 1px solid var(--g-color-danger);
}

.validation-message {
    color: var(--g-color-danger);
    font-size: var(--g-text-sm);
}

.button-link {
    text-decoration: unset;
}

/* Page titles used by the account pages. */
.title {
    display: flex;
    flex-direction: column;
    gap: var(--g-space-2);
    padding-bottom: var(--g-space-3);
}

    .title.title-secondary {
        padding-top: var(--g-space-1);
        padding-bottom: 0;
        color: var(--bs-secondary-color);
    }

.title-header-text {
    font-size: var(--g-text-3xl);
    line-height: 1.2;
    font-weight: 700;
    margin: 0 0 var(--g-space-2);
}

.title-content-text {
    font-size: var(--g-text-xl);
    font-weight: 400;
    line-height: 1.4;
}

.title-content-text-secondary {
    font-size: var(--g-text-xl);
    line-height: 1.4;
}

/* Error banner shown by blazor.web.js when the circuit hits an unhandled error. */
#blazor-error-ui {
    background: var(--g-color-warning-soft);
    color: var(--g-color-text);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 3rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
        border: 0;
        background: none;
    }

/* Printable pages keep light colours in dark mode (tokens.css redefines them inside). */
.g-theme-light {
    color: var(--g-color-text);
    background: var(--g-color-surface);
}

/* A fieldset's legend used as a field label reads like one, not like a heading. */
legend.form-label {
    font-size: var(--g-text-md);
    margin-bottom: var(--g-space-2);
}
