﻿:root {
    --ink: #1a1714;
    --paper: #faf6f0;
    --line: #e0d7ca;
    --muted: #6b6259;
    --accent: #e2563c;
    --accent-press: #c4452e;
    /* Default near-black; a theme with an accent replaces it with the accent's darkest shade (ThemeColors). */
    --header: #212529;
    --page: var(--paper);
    --field-bg: #fff;
    --radius: 10px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }

.site-header {
    background: var(--header);
}

.site-header__inner {
    /* No max-width or auto margins, so the logo stays left-aligned instead
       of being centred in a content column. Padding insets it from the top
       and left edges rather than sitting hard against them. */
    padding: .75rem 1.25rem;
}

.site-header__brand {
    display: inline-flex;
    text-decoration: none;
}

.site-header__logo {
    height: 34px;
    display: block;
}

/* Text brand, used when the host has no logo. Same height as the logo. */
.site-header__name {
    color: #fff;
    font: 600 1.25rem/34px var(--font);
    letter-spacing: .01em;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(circle at 15% 0%, color-mix(in srgb, var(--accent) 12%, var(--page)) 0, transparent 45%),
        var(--page);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.shell {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 2rem 1.25rem;
}

.card {
    width: 100%;
    max-width: 380px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2.25rem 2rem;
    box-shadow: 0 1px 0 #fff inset, 0 18px 40px -28px rgba(40, 30, 20, .5);
}

.card__head { margin-bottom: 1.75rem; }

.eyebrow {
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
}

.card__head h1 {
    font-size: 1.7rem;
    margin: .55rem 0 .25rem;
    letter-spacing: -.02em;
}

.sub { margin: 0; color: var(--muted); font-size: .92rem; }

.form { display: grid; gap: 8px; }

.field { display: grid; gap: .4rem; }

.field > span:first-child {
    font-size: .8rem;
    font-weight: 600;
    color: var(--ink);
}

.field input,
.field textarea {
    font: inherit;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--field-bg);
    transition: border-color .15s, box-shadow .15s;
}

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.check {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .88rem;
    color: var(--muted);
}

.btn {
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 6px;
    margin-top: .25rem;
    border: none;
    border-radius: 8px;
    color: #fff;
    background: var(--accent);
    transition: background .15s, box-shadow .15s, transform .05s;
}

/* Hover: the darker shade plus a soft ring, so it's obvious beyond the cursor. */
.btn:hover { background: var(--accent-press); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }

/* Submitted and waiting for the server (js/forms.js): spinner before the busy text. */
.btn.is-busy, .link.is-busy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    cursor: progress;
}
.btn.is-busy::before, .link.is-busy::before {
    content: "";
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin .7s linear infinite;
    flex: none;
}
.btn:disabled { cursor: progress; opacity: .85; }
.btn:disabled:hover { background: var(--accent); box-shadow: none; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .btn.is-busy::before, .link.is-busy::before { animation-duration: 2s; }
}

.card__foot {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: .88rem;
}

.card__foot a { color: var(--accent); text-decoration: none; font-weight: 500; }
.card__foot a:hover { text-decoration: underline; }

/* A form button that reads like the footer links (for POST actions such as resending a code). */
.card__foot form { margin: 0; }
.card__foot .link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); font-weight: 500; cursor: pointer; }
.card__foot .link:hover { text-decoration: underline; }

.form__errors, .field__error { color: var(--accent-press); font-size: .82rem; }
.form__errors:empty { display: none; }

/* Requirements stated before submission, not after a rejection. */
.field textarea { resize: vertical; min-height: 5.5rem; }

.field__optional { color: var(--muted); font-style: normal; font-weight: 400; }

.field__hint { color: var(--muted); font-size: .78rem; line-height: 1.35; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* The footer can now hold more than one link (reset password, and in Open mode
   "create an account"). Flex with a gap so they don't run together, and wrap on a
   narrow viewport rather than overflowing the card. */
.card__foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem 1.25rem;
}

/* Confirmation shown on the login page after a completed password reset. */
.status {
    margin: 0 0 1.25rem;
    padding: .75rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, .03);
    font-size: .88rem;
}

/* Wider card for longer forms (registration). */
.card--wide { max-width: 580px; }

/* Label beside its input, labels in one column so the inputs line up. Hints, errors and the
   CAPTCHA sit under the input. Stacks again on a narrow screen. */
.form--aligned .field {
    grid-template-columns: 11rem 1fr;
    column-gap: 1rem;
    align-items: center;
}
.form--aligned .field > :not(:first-child) { grid-column: 2; }
.form--aligned .field--top { align-items: start; }
.form--aligned .field--top > span:first-child { padding-top: 4px; }
.form--aligned .field__optional { display: block; }
.form--aligned .cf-turnstile { margin-left: 12rem; }

@media (max-width: 560px) {
    .form--aligned .field { grid-template-columns: 1fr; }
    .form--aligned .field > :not(:first-child) { grid-column: 1; }
    .form--aligned .field--top > span:first-child { padding-top: 0; }
    .form--aligned .field__optional { display: inline; }
    .form--aligned .cf-turnstile { margin-left: 0; }
}
