/* Public pages (home + auth): page chrome, sign-in card, form primitives.
   Consumes brand.css tokens only — follows the OS theme via data-theme. */
@import url("/static/css/brand.css");

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

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

body.public {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: "Raleway", system-ui, sans-serif;
    line-height: 1.5;
}

a { color: var(--machine-text); }

/* ── Header ── */
.public-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: max(1rem, env(safe-area-inset-top)) 1.25rem 1rem;
    max-width: 72rem;
    width: 100%;
    margin: 0 auto;
}

.public-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text-strong);
}

.public-wordmark {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.public-nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 0.9rem;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}

.public-nav-link:hover { background: var(--surface); }

/* ── Footer ── */
.public-footer {
    padding: 1.25rem 1.25rem max(1.25rem, env(safe-area-inset-bottom));
    text-align: center;
    color: var(--text-faint);
    font-size: 0.8rem;
}

/* ── Auth pages: one centred card ── */
.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.25rem 2rem;
}

.auth-main .auth-card {
    width: 100%;
    max-width: 26rem;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    box-shadow: var(--shadow-card);
    padding: 1.5rem 1.25rem;
}

@media (min-width: 480px) {
    .auth-card { padding: 2rem; }
}

.auth-title {
    margin: 0 0 0.35rem;
    color: var(--text-strong);
    font-size: 1.35rem;
    font-weight: 700;
}

.auth-subtitle {
    margin: 0 0 1.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* A title with no subtitle (home card) still needs room before the form. */
.auth-title + .alert,
.auth-title + .auth-form { margin-top: 1rem; }

.auth-link {
    margin: 1.25rem 0 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-link a {
    font-weight: 600;
    text-decoration: none;
}

.auth-link a:hover { text-decoration: underline; }

.auth-link--small {
    margin-top: 0.5rem;
    font-size: 0.825rem;
}

/* Verify-email outcome */
.auth-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.auth-status .btn-primary { margin-top: 0.5rem; }

.auth-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    margin-bottom: 1rem;
    border-radius: 999px;
    border: 1px solid;
    font-size: 1.75rem;
}

.auth-status-icon--success {
    background: var(--vivant-soft);
    border-color: var(--vivant-border);
    color: var(--vivant-text);
}

.auth-status-icon--error {
    background: var(--danger-soft);
    border-color: var(--danger-border);
    color: var(--danger-text);
}

/* ── Form primitives ── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 600;
}

.form-input {
    width: 100%;
    min-height: 48px;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border-strong);
    border-radius: 0.6rem;
    background: var(--surface-2);
    color: var(--text-strong);
    font: inherit;
    font-size: 1rem;   /* ≥16px: iOS doesn't zoom on focus */
    font-weight: 500;
}

.form-input::placeholder { color: var(--text-faint); }

.form-input:focus {
    outline: none;
    border-color: var(--machine-border);
    box-shadow: 0 0 0 3px var(--machine-soft);
}

.password-wrapper { position: relative; }

.password-wrapper .form-input { padding-right: 3rem; }

.password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 48px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-faint);
    font-size: 1.15rem;
    cursor: pointer;
}

.password-toggle:hover { color: var(--text); }

.checkbox-group {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 44px;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-group input {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--accent-human);
}

/* Gold = the human's decision (BRAND.md §5). Also used on <a>. */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    padding: 0 1.25rem;
    border: none;
    border-radius: 0.6rem;
    background: var(--accent-human);
    color: var(--on-human);
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.btn-primary:hover { filter: brightness(1.05); }

.btn-primary:focus-visible {
    outline: 3px solid var(--human-border);
    outline-offset: 2px;
}

/* ── Flash messages (ocre for errors, never alarm red) ── */
.alert {
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.6rem;
    border: 1px solid var(--machine-border);
    background: var(--machine-soft);
    color: var(--machine-text);
    font-size: 0.9rem;
}

.alert-error {
    border-color: var(--danger-border);
    background: var(--danger-soft);
    color: var(--danger-text);
}

.alert-success {
    border-color: var(--vivant-border);
    background: var(--vivant-soft);
    color: var(--vivant-text);
}
