/* The sign-in pages of internet.mattfor.com. Served by bin/internet-gate, so they work before you are let in. */

:root {
    color-scheme: light;
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f2f4f7;
    --border: rgba(16, 24, 40, 0.1);
    --border-strong: rgba(16, 24, 40, 0.2);
    --text: #101828;
    --text-2: #475467;
    --muted: #667085;
    --accent: #2a78d6;
    --accent-soft: rgba(42, 120, 214, 0.1);
    --good: #0ca30c;
    --good-ink: #12701a;
    --bad: #d03b3b;
    --bad-ink: #b42323;
    --bad-soft: rgba(208, 59, 59, 0.1);
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 28px rgba(16, 24, 40, 0.08);
    --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
        color-scheme: dark;
        --bg: #0e1116;
        --surface: #161b22;
        --surface-2: #1c222b;
        --border: rgba(240, 246, 252, 0.09);
        --border-strong: rgba(240, 246, 252, 0.18);
        --text: #e9edf2;
        --text-2: #b3bdca;
        --muted: #8b96a5;
        --accent: #3987e5;
        --accent-soft: rgba(57, 135, 229, 0.16);
        --good-ink: #4cc24c;
        --bad-ink: #ef6b6b;
        --bad-soft: rgba(208, 59, 59, 0.18);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.4);
    }
}

:root[data-theme='dark'] {
    color-scheme: dark;
    --bg: #0e1116;
    --surface: #161b22;
    --surface-2: #1c222b;
    --border: rgba(240, 246, 252, 0.09);
    --border-strong: rgba(240, 246, 252, 0.18);
    --text: #e9edf2;
    --text-2: #b3bdca;
    --muted: #8b96a5;
    --accent: #3987e5;
    --accent-soft: rgba(57, 135, 229, 0.16);
    --good-ink: #4cc24c;
    --bad-ink: #ef6b6b;
    --bad-soft: rgba(208, 59, 59, 0.18);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.4);
}

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

html {
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
    display: grid;
    place-items: center;
    padding: calc(24px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
        calc(24px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 var(--font);
    -webkit-font-smoothing: antialiased;
}

[hidden] {
    display: none !important;
}
a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
code {
    font-family: var(--mono);
    font-size: 0.9em;
    background: var(--surface-2);
    padding: 1px 5px;
    border-radius: 5px;
}

.panel {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 30px 28px 26px;
}

.mark {
    width: 52px;
    height: 52px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #fff;
    margin-bottom: 18px;
}
.mark svg {
    width: 28px;
    height: 28px;
}

h1 {
    margin: 0 0 6px;
    font-size: 23px;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.lead {
    margin: 0 0 20px;
    color: var(--text-2);
}
.site {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 4px;
    font-weight: 550;
}

.btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    border-radius: 12px;
    padding: 12px 16px;
    font: inherit;
    font-weight: 600;
    font-size: 15.5px;
    cursor: pointer;
}
.btn:hover {
    filter: brightness(1.06);
}
.btn:disabled {
    opacity: 0.6;
    cursor: progress;
}
.btn svg {
    width: 19px;
    height: 19px;
}
.btn.is-quiet {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}

label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    margin: 0 0 6px;
}
input[type='text'] {
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    margin-bottom: 14px;
}
input[type='text']:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
input.code {
    font-family: var(--mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.message {
    margin: 14px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
}
.message.is-error {
    background: var(--bad-soft);
    color: var(--bad-ink);
}
.message.is-info {
    background: var(--accent-soft);
    color: var(--text);
}
.message.is-good {
    background: rgba(12, 163, 12, 0.12);
    color: var(--good-ink);
}

.note {
    margin: 18px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
}
.note p {
    margin: 0 0 6px;
}
.links {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 14px;
    font-size: 14px;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* iOS zooms into any field under 16 px when it is focused */
input[type='text'] {
    font-size: 16px;
}
@media (max-width: 380px) {
    .panel {
        padding: 24px 18px 20px;
    }
}

/* the sign-in page: the domain and one button, in the middle of the screen */
.solo {
    width: 100%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}
.solo .site {
    margin: 0;
    font-size: 15px;
    color: var(--muted);
    font-weight: 550;
}
.solo .btn {
    padding: 13px 16px;
    font-size: 16px;
}
/* a failed attempt says so without words: the button flashes red and shakes */
.btn.is-error {
    background: var(--bad);
    border-color: var(--bad);
    animation: shake 0.35s ease-in-out;
}
@keyframes shake {
    25% {
        transform: translateX(-6px);
    }
    50% {
        transform: translateX(5px);
    }
    75% {
        transform: translateX(-3px);
    }
}
@media (prefers-reduced-motion: reduce) {
    .btn.is-error {
        animation: none;
    }
}
