/* ==========================================================================
   RTP Auto – Sign in, forgot password, reset password (<x-auth-card>)
   Depends on the tokens defined in site.css. Shares the homepage's Triangle
   motif; the little road in the brand panel tracks form progress (auth.js).
   ========================================================================== */

.auth {
    padding: clamp(1.5rem, 5vw, 4.5rem) 0;
    background:
        radial-gradient(40% 50% at 100% 0%, rgb(43 182 232 / 10%), transparent 70%),
        var(--c-bg);
    font-family: var(--f-body);
    color: var(--c-text);
}

.auth__card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    max-width: 1040px;
    margin-inline: auto;
    border-radius: 32px;
    background: var(--c-surface);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgb(11 22 38 / 4%);
    overflow: hidden;
}

/* ---------- Brand panel ---------- */
.auth__brand {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    padding: clamp(2rem, 4vw, 3.25rem);
    background:
        radial-gradient(70% 60% at 100% 0%, rgb(43 182 232 / 24%), transparent 65%),
        radial-gradient(60% 50% at 0% 100%, rgb(217 54 62 / 20%), transparent 70%),
        var(--c-ink);
    color: var(--c-on-dark);
    overflow: hidden;
}

.auth__decor { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.auth__decor::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgb(255 255 255 / 4%) 1px, transparent 1px),
        linear-gradient(90deg, rgb(255 255 255 / 4%) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(90% 70% at 70% 20%, #000, transparent 75%);
    -webkit-mask-image: radial-gradient(90% 70% at 70% 20%, #000, transparent 75%);
}
.auth__decor .tri { position: absolute; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.auth__decor .tri--a { top: 8%; right: -20px; width: 150px; height: 130px; background: linear-gradient(160deg, rgb(43 182 232 / 35%), transparent 75%); }
.auth__decor .tri--b { top: 46%; left: 58%; width: 54px; height: 46px; background: linear-gradient(160deg, rgb(217 54 62 / 45%), transparent 80%); }

.auth__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin: 0 0 1.25rem;
    color: var(--c-brand);
    font-family: var(--f-display);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}
.auth__eyebrow::before {
    content: "";
    width: 10px;
    height: 9px;
    background: currentColor;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.auth__headline {
    margin: 0;
    max-width: 15ch;
    color: #fff;
    font-family: var(--f-display);
    font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1.08;
    text-wrap: balance;
}

.auth__perks {
    display: grid;
    gap: .9rem;
    margin: 2rem 0 2.5rem;
    padding: 0;
    list-style: none;
}
.auth__perks li {
    display: flex;
    align-items: center;
    gap: .85rem;
    color: var(--c-on-dark-muted);
    font-size: 1rem;
}
.auth__perks svg {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 8px;
    border: 1px solid rgb(255 255 255 / 12%);
    border-radius: 11px;
    background: rgb(255 255 255 / 6%);
    fill: none;
    stroke: var(--c-brand);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- The road: --progress goes 0 → .5 → 1 as the form fills in ---------- */
.road {
    --car-w: 92px;
    position: relative;
    height: 64px;
    margin-top: auto;
    border-radius: 14px;
    background: rgb(255 255 255 / 4%);
    border: 1px solid rgb(255 255 255 / 8%);
}
.road__lane {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 10px;
    height: 2px;
    background: repeating-linear-gradient(90deg, rgb(255 255 255 / 28%) 0 14px, transparent 14px 26px);
}
.road__bay {
    position: absolute;
    right: 10px;
    top: 8px;
    bottom: 8px;
    width: calc(var(--car-w) + 14px);
    display: grid;
    place-items: start end;
    padding: 2px 6px;
    border: 1.5px dashed rgb(255 255 255 / 25%);
    border-radius: 10px;
    color: rgb(255 255 255 / 45%);
    font-family: var(--f-display);
    font-size: .7rem;
    font-weight: 800;
    transition: border-color .4s, color .4s, background-color .4s;
}
.road__car {
    position: absolute;
    left: 14px;
    bottom: 6px;
    width: var(--car-w);
    color: var(--c-on-dark-muted);
    transform: translateX(calc(var(--progress) * (var(--road-w, 300px) - var(--car-w) - 37px)));
    transition: transform .9s var(--ease), color .4s, opacity .4s;
}
.road__car .body-icon { display: block; width: 100%; height: auto; }
/* Wheels turn in proportion to the distance travelled */
.road .body-icon__wheel {
    transform-box: fill-box;
    transform-origin: center;
    transform: rotate(calc(var(--progress) * 1080deg));
    transition: transform .9s var(--ease);
}

/* Parked (form ready, or the reset email is on its way): bay lights up */
.road:is([data-step="ready"], [data-step="done"]) .road__bay { border-color: var(--c-brand); border-style: solid; color: var(--c-brand); background: rgb(43 182 232 / 10%); }
.road:is([data-step="ready"], [data-step="done"]) .road__car { color: #fff; }

/* Submitting: drive off */
.road[data-step="go"] .road__car { transform: translateX(calc(var(--road-w, 300px) + 20px)); opacity: 0; transition-duration: .7s; transition-timing-function: cubic-bezier(.5, 0, .9, .4); }

/* ---------- Form panel ---------- */
.auth__form {
    padding: clamp(2rem, 4.5vw, 3.5rem);
}

.auth__kicker {
    margin: 0 0 .4rem;
    color: var(--c-brand-text);
    font-family: var(--f-display);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.auth__title {
    margin: 0;
    color: var(--c-text);
    font-family: var(--f-display);
    font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.15;
}
.auth__lead {
    margin: .6rem 0 2rem;
    color: var(--c-muted);
    font-size: 1rem;
}

.auth-form { display: grid; gap: 1.25rem; }

.auth-field label {
    display: block;
    margin: 0 0 .45rem;
    color: var(--c-text);
    font-family: var(--f-display);
    font-size: .875rem;
    font-weight: 700;
}
.auth-field__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }

.auth-field__control {
    position: relative;
    display: flex;
    align-items: center;
    border: 1.5px solid var(--c-line);
    border-radius: 16px;
    background: #f8fafc;
    transition: border-color .2s, background-color .2s, box-shadow .2s;
}
.auth-field__control:hover { border-color: #cbd5e1; }
.auth-field__control:focus-within {
    border-color: var(--c-brand-text);
    background: #fff;
    box-shadow: 0 0 0 4px rgb(43 182 232 / 22%);
}
.auth-field__control > svg {
    position: absolute;
    left: 1rem;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--c-muted);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
    transition: stroke .2s;
}
.auth-field__control:focus-within > svg { stroke: var(--c-brand-text); }

.auth-field input {
    width: 100%;
    min-height: 54px;
    margin: 0;
    padding: 0 1rem 0 3rem;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: var(--c-text);
    font: 500 1rem var(--f-body);
    box-shadow: none;
}
.auth-field input:focus { outline: none; }
.auth-field input[type="password"],
.auth-field input[name="password"] { padding-right: 3.5rem; }

.auth-field__toggle {
    position: absolute;
    right: .4rem;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--c-muted);
    cursor: pointer;
    transition: background-color .2s, color .2s;
}
.auth-field__toggle:hover { background: var(--c-line); color: var(--c-text); }
.auth-field__toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-field__toggle .icon-hide,
.auth-field__toggle[aria-pressed="true"] .icon-show { display: none; }
.auth-field__toggle[aria-pressed="true"] .icon-hide { display: block; }

.auth-field__error,
.auth-field__hint {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: .45rem 0 0;
    font-size: .875rem;
    font-weight: 600;
}
.auth-field__error[hidden],
.auth-field__hint[hidden] { display: none; }
.auth-field__error { color: var(--c-coral-hover); }
.auth-field__error::before {
    content: "!";
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--c-coral-hover);
    color: #fff;
    font-size: .7rem;
    font-weight: 800;
}
.auth-field__hint { color: #8a5a00; }

.auth-field.has-error .auth-field__control { border-color: var(--c-coral); background: #fff7f7; }
.auth-field.has-error .auth-field__control:focus-within { box-shadow: 0 0 0 4px rgb(217 54 62 / 18%); }

.auth-link {
    color: var(--c-brand-text);
    font-size: .875rem;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgb(7 117 156 / 35%);
    text-underline-offset: 3px;
}
.auth-link:hover { color: var(--c-ink); text-decoration-color: currentColor; }

/* ---------- Submit ---------- */
.auth-form__submit {
    width: 100%;
    min-height: 56px;
    margin-top: .5rem;
    font-size: 1rem;
}
.auth-form__arrow { transition: transform .25s var(--ease); }
.auth-form__submit:hover .auth-form__arrow { transform: translateX(4px); }

.auth-form__spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgb(255 255 255 / 40%);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin .7s linear infinite;
}
.auth-form__submit[aria-busy="true"] { cursor: progress; opacity: .9; }
.auth-form__submit[aria-busy="true"] .auth-form__spinner { display: block; }
.auth-form__submit[aria-busy="true"] .auth-form__arrow { display: none; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* ---------- New here ---------- */
.auth__new {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--c-line);
}
.auth__new p { margin: 0; max-width: 30ch; color: var(--c-muted); font-size: .95rem; line-height: 1.5; }
.auth__new strong { color: var(--c-text); }
.auth__new-link {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 44px;
    padding: .6rem 1.1rem;
    border: 1.5px solid var(--c-line);
    border-radius: 999px;
    color: var(--c-text);
    font-family: var(--f-display);
    font-size: .875rem;
    font-weight: 700;
    white-space: nowrap;
    transition: background-color .2s, border-color .2s, color .2s;
}
.auth__new-link::after { content: "→"; transition: transform .25s var(--ease); }
.auth__new-link:hover { border-color: var(--c-ink); background: var(--c-ink); color: #fff; }
.auth__new-link:hover::after { transform: translateX(3px); }

/* ---------- Numbered steps (forgot password) ---------- */
.auth__step {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: 1px solid rgb(255 255 255 / 12%);
    border-radius: 11px;
    background: rgb(255 255 255 / 6%);
    color: var(--c-brand);
    font-family: var(--f-display);
    font-weight: 800;
}

/* ---------- Status alert (e.g. "Your password has been changed") ---------- */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    margin: -.75rem 0 1.5rem;
    padding: .9rem 1rem;
    border-radius: 14px;
    font-size: .95rem;
}
.auth-alert p { margin: 0; color: inherit; }
.auth-alert svg { flex-shrink: 0; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.auth-alert--success { border: 1px solid #b7e4c7; background: #effaf3; color: #17603a; }

/* ---------- Live requirement hint ("At least 8 characters") ---------- */
.auth-field__help {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: .45rem 0 0;
    color: var(--c-muted);
    font-size: .875rem;
    transition: color .2s;
}
.auth-field__help::before {
    content: "";
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    transition: background-color .2s, border-color .2s;
}
.auth-field__help.is-met { color: #17603a; }
.auth-field__help.is-met::before {
    border-color: #17603a;
    background: #17603a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4L18 8'/%3E%3C/svg%3E") center / 11px no-repeat;
}

/* ---------- Remember me ---------- */
.auth-check {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    justify-self: start;
    min-height: 44px;
    margin: -.25rem 0 0;
    color: var(--c-text);
    font-size: .95rem;
    cursor: pointer;
    user-select: none;
}
.auth-check input { position: absolute; opacity: 0; width: 22px; height: 22px; margin: 0; cursor: pointer; }
.auth-check__box {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 1.5px solid #64748b; /* 4.8:1 – form controls need 3:1 */
    border-radius: 7px;
    background: #fff;
    transition: background-color .2s, border-color .2s;
}
.auth-check__box svg { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; transform: scale(0); transition: transform .2s var(--ease); }
.auth-check:hover .auth-check__box { border-color: var(--c-ink); }
.auth-check input:checked + .auth-check__box { border-color: var(--c-ink); background: var(--c-ink); }
.auth-check input:checked + .auth-check__box svg { transform: scale(1); }
.auth-check input:focus-visible + .auth-check__box { outline: 3px solid var(--c-brand); outline-offset: 2px; }

/* ---------- "Check your inbox" ---------- */
.auth-done__icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: 1.25rem;
    border-radius: 18px;
    background: rgb(43 182 232 / 12%);
    color: var(--c-brand-text);
}
.auth-done__icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-done .auth__title:focus { outline: none; }
.auth-done .auth__lead strong { color: var(--c-text); overflow-wrap: anywhere; }
.auth-done__tips {
    display: grid;
    gap: .5rem;
    margin: 0 0 2rem;
    padding: 1rem 1.1rem;
    border-radius: 14px;
    background: var(--c-bg);
    color: var(--c-muted);
    font-size: .925rem;
    list-style: none;
}
.auth-done__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 859.98px) {
    .auth__card { grid-template-columns: 1fr; border-radius: 26px; }
    /* Compact brand band on top: headline + road, perks dropped */
    .auth__brand { padding: 1.5rem 1.5rem 1.25rem; }
    .auth__eyebrow { margin-bottom: .6rem; }
    .auth__headline { max-width: none; font-size: 1.35rem; }
    .auth__perks { display: none; }
    .road { margin-top: 1.25rem; height: 56px; --car-w: 76px; }
}

@media (max-width: 479.98px) {
    .auth { padding-top: 1rem; }
    .auth .container { padding-inline: 10px; }
    .auth__form { padding: 1.75rem 1.25rem; }
    .auth__new { flex-direction: column; align-items: stretch; text-align: center; }
    .auth__new p { max-width: none; }
    .auth__new-link { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .auth *, .auth *::before, .auth *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
    /* The spinner is the only loading cue, so keep it turning – slowly */
    .auth-form__spinner { animation: auth-spin 1.5s linear infinite !important; }
}
.auth-alert--info { border: 1px solid #bfe3f3; background: #eef8fd; color: #0b4f6c; }
.auth-alert a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.auth-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 1rem; }
@media (max-width: 575.98px) { .auth-row { grid-template-columns: minmax(0, 1fr); } }
