/*
 * Portal styles. Hand written and self-contained on purpose: no build step, and the hotspot
 * walled garden blocks every other host, so nothing here may depend on a CDN.
 * Mobile first: the base rules describe a 360px phone, the one media query widens it.
 */

:root {
    /* Overridden per install by the style attribute on <html> (PORTAL_BRAND_COLOR). */
    --brand: #1d4ed8;
    --on-brand: #ffffff;

    --text: #17202e;
    --muted: #556070;
    --bg: #f2f4f7;
    --surface: #ffffff;
    --border: #8a94a3;
    --danger: #b42318;
    --danger-bg: #fef3f2;
    --focus: #101828;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgb(16 24 40 / 8%), 0 4px 12px rgb(16 24 40 / 6%);

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.375rem;

    /* Touch target. 44px is the floor; 48px leaves room for thumbs. */
    --control-height: 48px;
    --content-width: 26rem;
}

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

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

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--text-base);
    line-height: 1.5;
}

.card {
    width: 100%;
    max-width: var(--content-width);
    padding: var(--space-5) var(--space-4);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
    text-align: center;
}

.brand__logo {
    height: 56px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.brand__name {
    margin: 0;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.title {
    margin: 0 0 var(--space-4);
    font-size: var(--text-lg);
    line-height: 1.25;
    text-align: center;
}

.lead {
    margin: 0 0 var(--space-5);
    color: var(--muted);
    text-align: center;
}

.form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

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

.field__label {
    font-weight: 600;
}

.field__input {
    width: 100%;
    min-height: var(--control-height);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    /* 16px or more, otherwise iOS zooms the page when the field takes focus. */
    font-size: var(--text-base);
}

.field__input--invalid {
    border-color: var(--danger);
    border-width: 2px;
}

.field__hint {
    margin: 0;
    color: var(--muted);
    font-size: var(--text-sm);
}

/* Errors are text first; the colour only reinforces them. */
.field__error,
.alert {
    margin: 0;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    background: var(--danger-bg);
    color: var(--danger);
    font-size: var(--text-sm);
    font-weight: 600;
}

.alert {
    margin-bottom: var(--space-4);
    font-size: var(--text-base);
}

.button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--control-height);
    padding: var(--space-2) var(--space-4);
    border: 2px solid var(--brand);
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: var(--on-brand);
    font: inherit;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.button--secondary {
    background: var(--surface);
    color: var(--brand);
}

.field__input:focus-visible,
.button:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.notice {
    width: 100%;
    max-width: var(--content-width);
    color: var(--muted);
    font-size: var(--text-sm);
    text-align: center;
}

.notice p {
    margin: 0;
}

@media (min-width: 768px) {
    body {
        justify-content: center;
        padding: var(--space-6);
    }

    .card {
        padding: var(--space-6);
    }
}
