/* Login and account screens of Autorecambios Nervión.

   There is no CSS framework: this file is the whole stylesheet. It has two halves.
   The first, the brand block, holds the colours of Nervión's logo, shared with
   the website and the management application: charcoal for the headings, the
   logo's red for the action, white pages and grey text. A change of palette
   touches only this block. The second
   half is the structure, which reads only these variables. */

/* ── Font ─────────────────────────────────────────────────────────────── */
/* Open Sans, self-hosted (SIL Open Font License, wwwroot/fonts/OpenSans-OFL.txt):
   the CSP allows nothing from outside the service. The Latin subset covers Spanish. */
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/open-sans-latin-400-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/open-sans-latin-700-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('/fonts/open-sans-latin-800-normal.woff2') format('woff2');
}

/* ── Brand ────────────────────────────────────────────────────────────── */
/* Every text colour reaches 4.5:1 on the surface it sits on, and every border
   or outline that identifies a control reaches 3:1, on white (the input border
   is close to that limit: re-check it first when the colours change). Red is
   the action, the main button: the logo's red a shade deeper, so white text on
   it reaches 4.5:1; the logo's own red only for the stripe at the top. Errors keep their own brick red so they never read as an action. */
:root {
    --brand-2: #1d4f86;
    --accent: #c62a1b;
    --accent-deep: #a32216;
    --logo-red: #e33423;
    --heading: #3a3b36;
    --ink: #212529;
    --muted: #65665f;
    --page: #ffffff;
    --surface: #ffffff;
    --on-brand: #ffffff;
    --line-strong: #8a8a8a;
    --placeholder: #767676;
    --focus: var(--brand-2);
    --error: #8f2c20;
    --error-surface: #fdf3f2;
    --radius-control: 10px;
    --font-body: 'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-heading: var(--font-body);
}

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

html {
    height: 100%;
}

body {
    border-top: 4px solid var(--logo-red);
    background: var(--page);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    margin: 0;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

/* ── Content ──────────────────────────────────────────────────────────── */
/* The login alone, as in the other JQ identity services: no shop header, menu
   or footer, because this is its own service and Nervión's staff enter here too.
   Anchored at a fixed distance from the top, never centred vertically: an error
   that makes a form taller grows it downwards and leaves everything above it in
   place. */
.auth {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    align-items: center;
    padding: clamp(32px, 10vh, 96px) 20px 64px;
}

.auth__panel {
    width: 100%;
    max-width: 400px;
}

/* Nervión's logo, drawn at three times its height or more so it stays sharp. */
.auth__brand {
    margin: 0 0 32px;
    text-align: center;
}

.auth__brand-logo {
    display: inline-block;
    width: auto;
    max-width: 100%;
    height: 72px;
    vertical-align: top;
}

.auth__title {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--heading);
    margin: 0 0 8px;
    text-align: center;
    text-wrap: balance;
}

.auth__lead {
    color: var(--muted);
    margin: 0 0 24px;
    text-align: center;
}

.auth__hint {
    color: var(--muted);
    font-size: .85rem;
    margin: -10px 0 20px;
    text-align: center;
}

.auth__foot {
    color: var(--muted);
    font-size: .85rem;
    margin: 24px 0 0;
    text-align: center;
}

/* ── Fields ───────────────────────────────────────────────────────────── */
fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.field {
    margin-bottom: 16px;
}

.field__label {
    display: block;
    margin-bottom: 5px;
    font-size: .9rem;
    font-weight: 400;
    color: var(--muted);
}

.field__control {
    position: relative;
}

.field__input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
}

.field__input::placeholder {
    color: var(--placeholder);
    opacity: 1;
}

.field__input:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 3px var(--focus);
}

.field__input[aria-invalid="true"] {
    border-color: var(--error);
    box-shadow: inset 0 0 0 1px var(--error);
}

.field__input[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px var(--error);
}

.field__input--with-visibility {
    padding-right: 52px;
}

.field__visibility {
    position: absolute;
    top: 50%;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transform: translateY(-50%);
}

.field__visibility:hover {
    color: var(--heading);
}

.field__visibility:focus-visible {
    outline: 3px solid var(--focus);
}

.field__visibility-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.field__visibility-icon[hidden] {
    display: none;
}

/* A field's own errors, from the server (.field__error) or typed live
   (.field__validation), under its input. */
.field__error,
.field__validation {
    display: block;
    margin-top: 5px;
    color: var(--error);
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.4;
}

.field__error p {
    margin: 0;
}

.field__validation {
    margin: -8px 0 16px;
}

.field__validation:empty {
    display: none;
}

/* ── Remember me / forgotten password ─────────────────────────────────── */
.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .88rem;
    color: var(--muted);
    cursor: pointer;
}

.check__box {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--heading);
    cursor: pointer;
}

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

.link {
    color: var(--muted);
    font-size: .88rem;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.link:hover {
    color: var(--heading);
}

.link:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
/* Square and full width, as in the shop. */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 11px 18px;
    border: 2px solid transparent;
    border-radius: 0;
    font-family: var(--font-heading);
    font-size: .95rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.btn--primary {
    background: var(--accent);
    color: var(--on-brand);
}

.btn--primary:hover:not(:disabled) {
    background: var(--accent-deep);
}

.btn--secondary {
    background: var(--surface);
    border-color: var(--heading);
    color: var(--heading);
    margin-top: 10px;
}

.btn--secondary:hover:not(:disabled) {
    background: var(--heading);
    color: var(--on-brand);
}

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

/* A form that is being sent keeps its button readable ("Enviando…"): the darker
   shade, never a transparency that would wash the white text out. */
.btn:disabled {
    cursor: progress;
}

.btn--primary:disabled {
    background: var(--accent-deep);
}

/* ── Messages ─────────────────────────────────────────────────────────── */
/* An error box is the light background alone. On a form it carries only the
   errors that belong to no field and sits below the submit button. */
.alert {
    border-radius: var(--radius-control);
    font-size: .9rem;
    margin: 0 0 20px;
    padding: 12px 16px;
}

form .alert {
    margin: 16px 0 0;
}

.alert--error {
    background: var(--error-surface);
    color: var(--error);
    font-weight: 700;
}

.alert p {
    margin: 0;
}

.alert__detail {
    margin-top: 6px;
    font-size: .82rem;
    font-weight: 400;
}

.alert__meta {
    color: var(--muted);
    font-size: .78rem;
    margin-top: 10px;
    text-align: center;
    word-break: break-all;
}

@media (max-width: 420px) {
    .auth {
        padding: 32px 16px 48px;
    }

    .auth__brand {
        margin-bottom: 28px;
    }
}
