/*
 * The components only the IdP has. Colors, fonts, spacing and the type scale come from the shared
 * library's tokens (theme.css); this file names no color or font of its own (a test holds that).
 */

/* A page with one thing to do: a card in the middle of the window. */
.hn-card-page {
    max-width: 26rem;
    margin-inline: auto;
    padding-top: var(--hn-space-5);
}

.hn-card {
    padding: var(--hn-space-6);
    background-color: var(--hn-color-surface);
    border: var(--hn-border-width) solid var(--hn-color-border);
    border-radius: var(--hn-radius-surface);
}

.hn-card h1 {
    margin-bottom: var(--hn-space-4);
}

.hn-card > :last-child {
    margin-bottom: 0;
}

/* The account pages: their menu beside the page. */
.hn-account {
    display: grid;
    grid-template-columns: 14rem minmax(0, 36rem);
    align-items: start;
    gap: var(--hn-space-5);
    max-width: 56rem;
    margin-inline: auto;
}

.hn-account-menu {
    display: flex;
    flex-direction: column;
    gap: var(--hn-space-1);
}

.hn-account-menu-phone {
    display: none;
}

.hn-account-menu a,
.hn-account-menu-phone a {
    display: flex;
    align-items: center;
    min-height: var(--hn-control-height);
    padding-inline: var(--hn-control-padding-x);
    color: var(--hn-color-text);
    text-decoration: none;
    border-radius: var(--hn-radius-control);
    border-left: 0.1875rem solid transparent;
}

.hn-account-menu a:hover,
.hn-account-menu-phone a:hover {
    background-color: var(--hn-color-surface-alt);
}

.hn-account-menu a[aria-current],
.hn-account-menu-phone a[aria-current] {
    font-weight: var(--hn-font-weight-semibold);
    background-color: var(--hn-color-selected);
    border-left-color: var(--hn-color-indicator);
}

/* What is known about something: its name, and what it is. */
.hn-details {
    margin-bottom: 0;
}

.hn-details dt {
    color: var(--hn-color-text-muted);
    font-size: var(--hn-font-size-sm);
    font-weight: var(--hn-font-weight-normal);
}

.hn-details dd {
    margin-bottom: var(--hn-space-3);
    overflow-wrap: anywhere;
}

.hn-details > :last-child {
    margin-bottom: 0;
}

/* One of a list of things, each with its own button. */
.hn-item {
    padding-block: var(--hn-space-4);
    border-top: var(--hn-border-width) solid var(--hn-color-border);
}

.hn-item h2 {
    margin-bottom: var(--hn-space-3);
}

/* A page of facts, for reading rather than doing. */
.hn-wide-page {
    max-width: 56rem;
    margin-inline: auto;
}

.hn-client-logo {
    display: block;
    max-width: 100%;
    max-height: 4rem;
    margin-bottom: var(--hn-space-3);
}

/* What a group of boxes is about. */
.hn-card legend {
    margin-bottom: var(--hn-space-2);
    font-size: var(--hn-font-size-heading);
    font-weight: var(--hn-font-weight-semibold);
}

/* A form's buttons: the main one first. */
.hn-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--hn-space-2);
}

/* The links under a form. */
.hn-card-links {
    margin-top: var(--hn-space-4);
    margin-bottom: 0;
}

/* The top bar stays one line: a long name is cut short, and the menu shows it whole. */
.hn-topbar > .container-fluid {
    flex-wrap: nowrap;
}

.hn-user-button-name {
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* On a phone everything starts at the same edge, and the person's name is in the menu alone. */
@media (max-width: 767.98px) {
    .hn-user-button-name {
        position: absolute;
        width: 1px;
        height: 1px;
        clip-path: inset(50%);
    }

    .hn-footer {
        padding-inline: var(--hn-space-4);
    }

    .hn-topbar > .container-fluid {
        padding-inline: var(--hn-space-4);
    }
}

/* On a phone the page is the card: no edge around it, and the buttons as wide as the window. */
@media (max-width: 767.98px) {
    .hn-document {
        background-color: var(--hn-color-surface);
    }

    .hn-page {
        padding: var(--hn-space-4);
    }

    .hn-account {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--hn-space-4);
    }

    /* Above the page, behind a button. */
    .hn-account-menu {
        display: none;
    }

    .hn-account-menu-phone {
        display: block;
        border: var(--hn-border-width) solid var(--hn-color-border-strong);
        border-radius: var(--hn-radius-control);
    }

    .hn-account-menu-phone summary {
        display: flex;
        align-items: center;
        min-height: var(--hn-control-height);
        padding-inline: var(--hn-control-padding-x);
        font-weight: var(--hn-font-weight-semibold);
        cursor: pointer;
    }

    /* A caret at the end, in place of the browser's own mark at the start. */
    .hn-account-menu-phone summary::-webkit-details-marker {
        display: none;
    }

    .hn-account-menu-phone summary::after {
        content: "";
        width: 0.5rem;
        height: 0.5rem;
        margin-left: auto;
        border: solid currentColor;
        border-width: 0 0.125rem 0.125rem 0;
        transform: translateY(-0.125rem) rotate(45deg);
    }

    .hn-account-menu-phone[open] summary::after {
        transform: translateY(0.125rem) rotate(225deg);
    }

    .hn-account-menu-phone nav {
        padding: var(--hn-space-1);
        border-top: var(--hn-border-width) solid var(--hn-color-border);
    }

    .hn-card-page {
        max-width: none;
        padding-top: 0;
    }

    .hn-card {
        padding: 0;
        border: 0;
        border-radius: 0;
    }

    .hn-actions {
        flex-direction: column;
        align-items: stretch;
    }
}
