/*
 * The components of the sites that share this library. Colors, fonts, spacing and the type scale come from tokens in
 * theme.css; this file names no color or font of its own (a test holds that). A size that belongs
 * to one component only, such as the logo's, is written here.
 */

/* The logo and the name, as the brand shows them. */
.hn-wordmark {
    display: inline-flex;
    align-items: center;
    gap: var(--hn-space-2);
    font-family: var(--hn-font-brand);
    font-size: var(--hn-font-size-wordmark);
    font-weight: var(--hn-font-weight-semibold);
    color: var(--hn-color-text);
    text-decoration: none;
}

.hn-wordmark-logo {
    width: 1.375rem;
    height: 1.5rem;
}

/* Josefin Sans sits high in its line; this brings the name level with the logo. */
.hn-wordmark-name {
    padding-top: 0.2em;
}

/* An icon from the vendored Bootstrap Icons sprite, sized and colored like the text around it. */
.hn-icon {
    width: 1em;
    height: 1em;
    fill: currentColor;
    flex: none;
    vertical-align: -0.125em;
}

/* What is wrong with a field, under it. Empty until there is something to say. */
.field-validation-error {
    display: block;
    margin-top: var(--hn-space-1);
    color: var(--hn-color-danger);
    font-size: var(--hn-font-size-sm);
}

/* A hint under a control, such as the note under "Sign out of all other devices". Set here in full,
   at the size of a field's error message, so it does not follow whatever Bootstrap gives .form-text. */
.form-text {
    margin-top: var(--hn-space-1);
    color: var(--hn-color-text-muted);
    font-size: var(--hn-font-size-sm);
}

/* A password field with its "Show password" button at the right end (TagHelpers/PasswordRevealTagHelper.cs,
   js/password-reveal.js). The button is a square as tall as the field; the field's text stops before
   it, and a refused field's "!" mark sits just left of it. */
.hn-password {
    position: relative;
}

.hn-password .form-control {
    padding-right: var(--hn-control-height);
}

.hn-password .form-control.input-validation-error {
    padding-right: calc(var(--hn-control-height) + 1rem + var(--hn-space-2));
    background-position: right var(--hn-control-height) center;
}

/* Edge draws an eye of its own in a password field; one is enough. */
.hn-password .form-control::-ms-reveal {
    display: none;
}

.hn-password-reveal {
    position: absolute;
    top: 0;
    right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--hn-control-height);
    height: var(--hn-control-height);
    padding: 0;
    color: var(--hn-color-text-muted);
    background: none;
    border: 0;
    border-radius: var(--hn-radius-control);
}

.hn-password-reveal[hidden] {
    display: none;
}

.hn-password-reveal:hover {
    color: var(--hn-color-text);
}

.hn-password-reveal[aria-pressed="false"] .hn-password-hide,
.hn-password-reveal[aria-pressed="true"] .hn-password-show {
    display: none;
}

/* Everything wrong with a form, at its top. In the page from the start, so the validation scripts can
   fill it, and shown once it has something in it. */
.hn-error-summary.validation-summary-valid {
    display: none;
}

.hn-error-summary-title {
    margin-bottom: var(--hn-space-1);
    font-weight: var(--hn-font-weight-semibold);
}

.hn-error-summary ul {
    margin-bottom: 0;
    padding-left: var(--hn-space-4);
}

/* The shell (design section 8.3) --------------------------------------------------------------- */

/* A document page: the top bar, the page, and the footer at the bottom of the window even when the
   page is short. */
.hn-document {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.hn-page {
    flex: 1 0 auto;
    padding: var(--hn-space-5);
}

.hn-page:focus {
    outline: none;
}

.hn-skip-link:focus {
    position: absolute;
    top: var(--hn-space-2);
    left: var(--hn-space-2);
    z-index: 1100;
    padding: var(--hn-space-2) var(--hn-space-3);
    background-color: var(--hn-color-surface);
    color: var(--hn-color-link);
    border: var(--hn-border-width) solid var(--hn-color-border-strong);
    border-radius: var(--hn-radius-control);
}

/* The top bar: the brand's stripe along its top edge, a line along its bottom. */
.hn-topbar {
    min-height: var(--hn-header-height);
    padding-block: 0;
    background-color: var(--hn-color-surface);
    border-top: 0.1875rem solid var(--hn-color-brand-mark);
    border-bottom: var(--hn-border-width) solid var(--hn-color-border);
}

.hn-topbar .hn-wordmark {
    margin-right: var(--hn-space-5);
}

.hn-user-button {
    display: inline-flex;
    align-items: center;
    gap: var(--hn-space-2);
    color: var(--hn-color-text);
    border-color: var(--hn-color-border);
}

.hn-user-identity {
    padding: var(--hn-space-2) var(--hn-control-padding-x);
}

.hn-user-name {
    font-weight: var(--hn-font-weight-semibold);
}

.hn-footer {
    display: flex;
    flex-wrap: wrap;
    gap: var(--hn-space-2) var(--hn-space-5);
    padding: var(--hn-space-3) var(--hn-space-5);
    color: var(--hn-color-text-muted);
    font-size: var(--hn-font-size-sm);
    background-color: var(--hn-color-surface);
    border-top: var(--hn-border-width) solid var(--hn-color-border);
}
