/* Inter (SIL OFL 1.1, see fonts/OFL.txt), latin subset - same font files as uni-hohenheim.de */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("fonts/inter-latin-400-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("fonts/inter-latin-600-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("fonts/inter-latin-700-normal.woff2") format("woff2");
}

/* Colour tokens of the University of Hohenheim corporate design */
:root {
    --uhoh-blue: #003f75;
    --uhoh-blue-dark: #002545;
    --uhoh-blue-light: #bbe6ef;
    --uhoh-bg: #ecf1f1;
    --uhoh-white: #ffffff;
    --uhoh-stroke: #d1d5d5;
    --uhoh-text: #444444;
    --uhoh-text-muted: #767676;
    --uhoh-green-light: #e1eeb3;
    --uhoh-green-dark: #124e05;
    --uhoh-negative: #b4595b;
    --container-width: 1122px;
    --gutter: 1.75rem;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--uhoh-text);
    background-color: var(--uhoh-bg);
}

a {
    color: var(--uhoh-blue);
}

h1, h2, h3 {
    color: var(--uhoh-blue);
    font-weight: 600;
    line-height: 1.2;
}

h1 {
    font-size: 1.75rem;
    margin: 0 0 1rem;
}

h2 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
}

.container {
    width: 100%;
    max-width: calc(var(--container-width) + 2 * var(--gutter));
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.icon {
    width: 1.25rem;
    height: 1.25rem;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- University bar: logo + language switcher ---------- */

.uhoh-bar {
    background-color: var(--uhoh-bg);
}

.uhoh-bar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 1rem;
}

.uhoh-bar__logo {
    display: block;
    line-height: 0;
}

.uhoh-bar__logo img {
    height: 44px;
    width: auto;
}

.uhoh-bar__language {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--uhoh-blue);
}

.uhoh-bar__language a {
    text-decoration: none;
}

.uhoh-bar__language a:hover {
    text-decoration: underline;
}

.uhoh-bar__language a.is-active {
    font-weight: 700;
}

/* ---------- Application bar: title, user, logout, navigation ---------- */

.app-bar {
    background-color: var(--uhoh-white);
    border-bottom: 1px solid var(--uhoh-stroke);
}

.app-bar__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    min-height: 4rem;
    padding-block: 0.75rem;
}

.app-bar__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--uhoh-blue);
    text-decoration: none;
}

.app-bar__user {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
}

.app-bar__user form {
    margin: 0;
}

.app-bar__username {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: var(--uhoh-text);
}

.app-bar__username .icon {
    color: var(--uhoh-blue);
}

.app-nav__sections,
.app-nav__items-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
    /* Divider line spanning only the content column, not the container's gutters */
    background-image: linear-gradient(var(--uhoh-stroke), var(--uhoh-stroke));
    background-size: calc(100% - 2 * var(--gutter)) 1px;
    background-position: var(--gutter) 0;
    background-repeat: no-repeat;
}

.app-nav a {
    color: var(--uhoh-blue);
    text-decoration: none;
}

.app-nav a:hover {
    text-decoration: underline;
}

/* First level: sections, the active one underlined with a bar */
.app-nav__sections a {
    padding-block: 0.625rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

.app-nav__sections a.is-active {
    box-shadow: inset 0 -3px 0 var(--uhoh-blue);
}

/* Second level: items of the active section */
.app-nav__items-inner {
    padding-block: 0.5rem;
    font-size: 0.875rem;
}

.app-nav__items-inner a.is-active {
    font-weight: 700;
}

/* Item that is not available in the current state (e.g. only when signed out) */
.app-nav__disabled {
    color: var(--uhoh-text-muted);
    cursor: not-allowed;
}

/* ---------- Buttons ---------- */

.button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5625rem 1.125rem;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.25;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
}

.button--outline {
    color: var(--uhoh-blue);
    background-color: var(--uhoh-white);
    border: 1px solid var(--uhoh-stroke);
}

.button--outline:hover {
    border-color: var(--uhoh-blue);
}

.button--primary {
    color: var(--uhoh-white);
    background-color: var(--uhoh-blue);
    border: 1px solid var(--uhoh-blue);
}

.button--primary:hover {
    background-color: var(--uhoh-blue-dark);
}

/* Destructive actions (removing a 2FA token) */
.button--danger {
    color: var(--uhoh-negative);
    background-color: var(--uhoh-white);
    border: 1px solid var(--uhoh-negative);
}

.button--danger:hover {
    color: var(--uhoh-white);
    background-color: var(--uhoh-negative);
}

.button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--uhoh-blue);
    outline-offset: 2px;
}

/* ---------- Content ---------- */

main {
    flex: 1 0 auto;
    padding-block: 2.5rem 4rem;
}

.card {
    background-color: var(--uhoh-white);
    border: 1px solid var(--uhoh-stroke);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card > :first-child {
    margin-top: 0;
}

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

/* Cards side by side as long as each column keeps at least 28rem, otherwise stacked */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr));
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

.card-grid > .card {
    margin-bottom: 0;
}

.service-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
}

.service-links li {
    flex: 1 1 16rem;
}

.service-links a,
.service-links__disabled {
    display: block;
    height: 100%;
    padding: 1.25rem 1.5rem;
    color: var(--uhoh-text);
    text-decoration: none;
    background-color: var(--uhoh-white);
    border: 1px solid var(--uhoh-stroke);
    border-radius: 6px;
}

.service-links a:hover {
    border-color: var(--uhoh-blue);
}

.service-links strong {
    display: block;
    color: var(--uhoh-blue);
    font-size: 1.0625rem;
    font-weight: 600;
}

.service-links p {
    margin: 0.25rem 0 0;
    font-size: 0.9375rem;
}

/* Service that is not available in the current state (e.g. only when signed out) */
.service-links__disabled {
    color: var(--uhoh-text-muted);
    background-color: var(--uhoh-bg);
    border-style: dashed;
}

.service-links .service-links__disabled strong {
    color: var(--uhoh-text-muted);
}

.service-links .service-links__note {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    color: var(--uhoh-text);
    font-size: 0.875rem;
    border-top: 1px solid var(--uhoh-stroke);
}

/* ---------- Forms ---------- */

.result-message {
    max-width: 32rem;
    padding: 0.75rem 1rem;
    margin: 0 0 1rem;
    color: var(--uhoh-blue-dark);
    background-color: var(--uhoh-white);
    border: 1px solid var(--uhoh-stroke);
    border-left: 4px solid var(--uhoh-blue);
    border-radius: 4px;
}

/* Notice with a list of options: as wide as the lead text */
.result-message--wide {
    max-width: 48rem;
}

.result-message > p {
    margin: 0;
}

.result-message > .hint-list {
    margin: 0.5rem 0 0;
}

/* ---------- Footer (modelled on the SSPR footer) ---------- */

.site-footer {
    background-color: var(--uhoh-blue);
    color: var(--uhoh-white);
    font-size: 0.9375rem;
}

.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 5rem;
    padding-block: 2.5rem;
}

.site-footer h4 {
    margin: 0 0 0.5rem;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

.site-footer p {
    margin: 0;
}

.site-footer a,
.site-footer a:visited {
    color: var(--uhoh-white);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

.site-footer a:focus-visible {
    outline-color: var(--uhoh-white);
}

@media (max-width: 600px) {
    :root {
        --gutter: 1rem;
    }

    .uhoh-bar__logo img {
        height: 36px;
    }

    .app-bar__title {
        font-size: 1.125rem;
    }
}

/* ---------- Data list (data mirror) ---------- */

.data-list {
    display: grid;
    grid-template-columns: minmax(8rem, max-content) 1fr;
    gap: 0.75rem 2rem;
    margin: 0;
}

.data-list dt {
    font-weight: 600;
    color: var(--uhoh-text);
}

.data-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

/* Account expiry in the past (data mirror) */
.data-list dd.is-expired {
    color: var(--uhoh-negative);
    font-weight: 600;
}

@media (max-width: 600px) {
    .data-list {
        grid-template-columns: 1fr;
        gap: 0.125rem;
    }

    .data-list dd {
        margin-bottom: 0.75rem;
    }
}

/* ---------- MFA ---------- */

.muted {
    color: var(--uhoh-text-muted);
    font-size: 0.9375rem;
}

.result-message--error {
    color: var(--uhoh-negative);
    border-left-color: var(--uhoh-negative);
}

.token-list {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
    border-top: 1px solid var(--uhoh-stroke);
}

.token-list > li {
    border-bottom: 1px solid var(--uhoh-stroke);
}

.token-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding-block: 0.75rem;
}

.token-row__text {
    flex: 1 1 14rem;
    min-width: 0;
}

/* Name and status side by side, wrapping below each other on narrow screens */
.token-row__name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
}

.token-row__text strong {
    color: var(--uhoh-text);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.token-row__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.75rem;
    font-size: 0.8125rem;
    color: var(--uhoh-text-muted);
}

.token-row form {
    margin: 0;
}

.badge {
    padding: 0.125rem 0.625rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 999px;
    white-space: nowrap;
    color: var(--uhoh-text);
    background-color: var(--uhoh-bg);
}

.badge--active {
    color: var(--uhoh-green-dark);
    background-color: var(--uhoh-green-light);
}

.badge--locked {
    color: var(--uhoh-white);
    background-color: var(--uhoh-negative);
}

.button--small {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.inline-form label {
    font-size: 0.9375rem;
    font-weight: 600;
}

.inline-form input {
    flex: 0 1 18rem;
    min-width: 0;
    padding: 0.5625rem 0.875rem;
    font: inherit;
    font-size: 0.9375rem;
    color: var(--uhoh-text);
    border: 1px solid var(--uhoh-stroke);
    border-radius: 4px;
}

.inline-form input:focus {
    outline: none;
    border-color: var(--uhoh-blue);
    box-shadow: 0 0 0 1px var(--uhoh-blue);
}

/* Form with stacked fields (password recovery, modelled on SSPR's "update profile") */
.form-field {
    margin: 0 0 1.5rem;
}

.form-field label {
    display: block;
    font-weight: 600;
}

.form-field__hint {
    max-width: 40rem;
    margin: 0.25rem 0 0.5rem;
    font-size: 0.9375rem;
    color: var(--uhoh-text-muted);
}

.form-field .secret-field,
.form-field__input {
    width: 100%;
    max-width: 24rem;
}

.form-field__input {
    display: block;
    padding: 0.5625rem 0.875rem;
    font: inherit;
    font-size: 0.9375rem;
    color: var(--uhoh-text);
    border: 1px solid var(--uhoh-stroke);
    border-radius: 4px;
}

.form-field__input:focus {
    outline: none;
    border-color: var(--uhoh-blue);
    box-shadow: 0 0 0 1px var(--uhoh-blue);
}

.form-field__input[aria-invalid="true"],
.form-field .secret-field:has(input[aria-invalid="true"]) {
    border-color: var(--uhoh-negative);
}

.form-field__error {
    margin: 0.375rem 0 0;
    font-size: 0.9375rem;
    color: var(--uhoh-negative);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.webauthn-status {
    margin: 1rem 0 0;
    font-size: 0.9375rem;
}

.webauthn-status--error {
    color: var(--uhoh-negative);
}

.totp-setup {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2.5rem;
    align-items: flex-start;
}

.totp-setup__qr {
    flex: none;
    width: 220px;
    height: 220px;
    image-rendering: pixelated;
    border: 1px solid var(--uhoh-stroke);
}

.totp-setup__steps {
    flex: 1 1 20rem;
}

.totp-setup__steps ol {
    margin-top: 0;
    padding-left: 1.25rem;
}

.totp-setup__manual {
    margin: 1.25rem 0;
}

.totp-setup__manual label {
    font-size: 0.9375rem;
}

.totp-setup__settings {
    margin: 0.375rem 0 0;
    font-size: 0.875rem;
}

/* TOTP key: read-only field, masked like a password, scrolls horizontally (SHA-512 keys are long) */
.secret-field {
    flex: 1 1 16rem;
    min-width: 0;
    display: flex;
    align-items: stretch;
    background-color: var(--uhoh-white);
    border: 1px solid var(--uhoh-stroke);
    border-radius: 4px;
}

.secret-field:focus-within {
    border-color: var(--uhoh-blue);
    box-shadow: 0 0 0 1px var(--uhoh-blue);
}

.secret-field__input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.9375rem;
    letter-spacing: 0.08em;
    color: var(--uhoh-text);
    background: none;
    border: none;
    text-overflow: ellipsis;
}

.secret-field__input:focus {
    outline: none;
    text-overflow: clip;
}

.secret-field__toggle {
    display: flex;
    align-items: center;
    padding: 0 0.625rem;
    color: var(--uhoh-blue);
    background: none;
    border: none;
    border-left: 1px solid var(--uhoh-stroke);
    border-radius: 0 3px 3px 0;
    cursor: pointer;
}

.secret-field__toggle[hidden] {
    display: none;
}

.secret-field__toggle:hover {
    background-color: var(--uhoh-bg);
}

.secret-field__toggle:focus-visible {
    outline: 2px solid var(--uhoh-blue);
    outline-offset: -2px;
}

.secret-field__toggle[data-revealed="false"] .icon--eye-off,
.secret-field__toggle[data-revealed="true"] .icon--eye {
    display: none;
}

.totp-setup__app-link {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
}

.secret-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    margin-top: 0.25rem;
}

.secret-row .secret {
    margin-top: 0;
}

.copy-button {
    padding: 0.3125rem;
}

/* .button sets display, which would override the hidden attribute */
.copy-button[hidden] {
    display: none;
}

.copy-status {
    font-size: 0.875rem;
    color: var(--uhoh-text);
}

.totp-setup__cancel {
    margin-top: 1.25rem;
}

/* 2FA token and emergency code: one card, a section per kind of factor */
.factor + .factor {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--uhoh-stroke);
}

.factor h3 {
    margin: 0 0 0.25rem;
    font-size: 1.0625rem;
}

.factor > .muted {
    margin: 0 0 1rem;
}

.factor__empty {
    margin: 0 0 1rem;
    font-style: italic;
}

.factor form,
.factor > :last-child {
    margin-bottom: 0;
}

.step-up-hint {
    margin: 0.75rem 0 0;
}

/* The emergency code, shown once */
.emergency-code__notice {
    margin-bottom: 1.25rem;
}

.emergency-code__row {
    margin: 0 0 1.5rem;
}

.emergency-code__value {
    display: inline-block;
    padding: 0.75rem 1.25rem;
    font-size: 2rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.15em;
    overflow-wrap: anywhere;
    color: var(--uhoh-blue-dark);
    background-color: var(--uhoh-bg);
    border: 1px dashed var(--uhoh-blue);
    border-radius: 4px;
}

.emergency-code__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.data-mirror__actions {
    margin-top: 1.5rem;
}

.print-button[hidden] {
    display: none;
}

/* Printing (emergency code, data mirror): only the page content, without buttons */
@media print {
    .uhoh-bar,
    .app-bar,
    .app-nav,
    .site-footer,
    .skip-link,
    .button,
    .copy-status {
        display: none !important;
    }

    body,
    .card {
        background: none;
        border: none;
    }

    main {
        padding: 0;
    }
}

/* ---------- Dashboard ---------- */

.lead {
    max-width: 48rem;
    margin: 0 0 1.5rem;
    font-size: 1.0625rem;
}

.hint-list {
    margin: 0;
    padding-left: 1.25rem;
}

.hint-list li + li {
    margin-top: 0.5rem;
}

/* followed since the login: stays visible until the next login to encourage the other hints */
.hint-list__item--done {
    color: var(--uhoh-text-muted);
    text-decoration: line-through;
}

/* ---------- Info window (footer "About this portal", HTML popover) ---------- */

.site-footer__about {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.site-footer a.site-footer__legal {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.85);
}

.site-footer__about-button {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0;
    font: inherit;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.85);
    background: none;
    border: none;
    cursor: pointer;
}

.site-footer__about-button:hover {
    color: var(--uhoh-white);
    text-decoration: underline;
}

.site-footer__about-button .icon {
    width: 1.125rem;
    height: 1.125rem;
}

.about-dialog {
    width: min(26rem, calc(100vw - 2rem));
    padding: 1.75rem;
    color: var(--uhoh-text);
    font-size: 0.9375rem;
    background-color: var(--uhoh-white);
    border: 1px solid var(--uhoh-stroke);
    border-radius: 6px;
    box-shadow: 0 12px 40px rgba(0, 37, 69, 0.25);
}

.about-dialog::backdrop {
    background-color: rgba(0, 37, 69, 0.35);
}

.about-dialog h2 {
    margin: 1rem 0 1rem;
}

.about-dialog .data-list {
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1.5rem;
}

/* inside <footer>, so it must beat ".site-footer p { margin: 0 }" */
.site-footer .about-dialog__copyright {
    margin: 1.25rem 0 1.5rem;
    color: var(--uhoh-text-muted);
    font-size: 0.875rem;
}

/* ---------- Accessibility helpers, external-link marker, error page ---------- */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -3rem;
    left: 1rem;
    z-index: 10;
    padding: 0.5rem 1rem;
    color: var(--uhoh-white);
    background-color: var(--uhoh-blue);
    border-radius: 4px;
}

.skip-link:focus {
    top: 1rem;
}

.icon--external,
.icon--lock {
    width: 0.95em;
    height: 0.95em;
    margin-left: 0.2em;
    vertical-align: -0.05em;
    stroke-width: 2;
}

.error-card {
    max-width: 40rem;
}

.error-card__status {
    margin: 0 0 0.25rem;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--uhoh-text-muted);
}

.error-card h1 {
    margin-bottom: 0.75rem;
}

.error-card .button {
    margin-top: 0.5rem;
}
