/* ==========================================================================
   Auth screens — v6 (liquid glass)
   Hero + logo match traffordenterprises.co.uk
   ========================================================================== */

.auth-page {
    --ink: #151b21;
    --ink-2: #46515b;
    --ink-3: #6e7983;
    --danger: #9b1c1c;
    --ctl-radius: 14px;
    --card-radius: 28px;

    color-scheme: light;
    margin: 0;
    min-height: 100%;
    background: #d3d9dd;
    color: var(--ink);
    font-family: 'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

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

.auth-page a {
    color: inherit;
}

/* ---------- Background ---------- */

.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: #d3d9dd url('../images/login-hero.webp') 50% 50% / cover no-repeat;
}

.auth-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(90% 70% at 0% 100%, rgba(255, 255, 255, .38), transparent 60%),
        linear-gradient(180deg, rgba(110, 124, 135, .12), transparent 35%);
}

/* ---------- Layout ---------- */

.auth-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 1360px;
    margin: 0 auto;
    padding: clamp(24px, 4vw, 48px) clamp(20px, 5vw, 72px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "logo logo"
        "copy card"
        "foot foot";
    column-gap: clamp(40px, 7vw, 120px);
    row-gap: 32px;
}

.auth-logo-link {
    grid-area: logo;
    display: block;
    justify-self: start;
    align-self: start;
    width: 260px;
    max-width: 100%;
}

.auth-logo {
    display: block;
    width: 100%;
    height: auto;
}

.auth-copy {
    grid-area: copy;
    align-self: center;
    max-width: 520px;
}

.auth-demo-wrap {
    margin: 0 0 18px;
}

.auth-demo {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: #b42318;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.auth-headline {
    margin: 0 0 16px;
    font-family: inherit;
    font-weight: 300;
    font-size: clamp(34px, 3.4vw, 50px);
    line-height: 1.12;
    letter-spacing: -.02em;
    color: var(--ink);
}

.auth-lede {
    margin: 0;
    max-width: 420px;
    font-size: 17px;
    color: var(--ink-2);
}

/* ---------- Liquid glass ---------- */

.glass {
    position: relative;
    isolation: isolate;
    border-radius: var(--card-radius);
    background: linear-gradient(160deg,
            rgba(255, 255, 255, .46) 0%,
            rgba(255, 255, 255, .20) 40%,
            rgba(255, 255, 255, .12) 62%,
            rgba(255, 255, 255, .30) 100%);
    -webkit-backdrop-filter: blur(26px) saturate(165%);
    backdrop-filter: blur(26px) saturate(165%);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, .95),
        inset 0 -1px 1px rgba(255, 255, 255, .35),
        inset 0 0 28px rgba(255, 255, 255, .20),
        0 2px 6px rgba(21, 27, 33, .06),
        0 32px 72px -26px rgba(21, 32, 42, .50);
}

/* Specular rim: bright top-left, fading, catching light again bottom-right */
.glass::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1.25px;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, .95) 0%,
            rgba(255, 255, 255, .25) 30%,
            rgba(255, 255, 255, .06) 55%,
            rgba(255, 255, 255, .55) 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Soft sheen that follows the pointer (set via --mx / --my) */
.glass::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: radial-gradient(520px circle at var(--mx, 18%) var(--my, -10%),
            rgba(255, 255, 255, .38), transparent 45%);
    pointer-events: none;
    transition: opacity .4s ease;
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .glass {
        background: rgba(244, 246, 248, .94);
    }
}

/* ---------- Card ---------- */

.auth-card {
    grid-area: card;
    align-self: center;
    justify-self: end;
    width: 100%;
    max-width: 440px;
    margin: 0;
    padding: 40px 36px 32px;
}

.auth-card-head {
    margin-bottom: 28px;
}

.auth-card-head h1 {
    margin: 0 0 6px;
    font-family: inherit;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -.015em;
    color: var(--ink);
}

.auth-card-head p {
    margin: 0;
    color: var(--ink-2);
    font-size: 15px;
}

/* ---------- Fields ---------- */

.auth-field {
    margin-bottom: 18px;
}

.auth-field label {
    display: block;
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--ink-2);
}

.auth-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.auth-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink) !important;
    border-bottom: 1px solid rgba(21, 27, 33, .25);
    transition: border-color .2s ease;
}

.auth-link:hover {
    border-bottom-color: var(--ink);
}

.auth-input-wrap {
    position: relative;
}

/* Minimal line icons (inline SVG, inherit colour) */
.auth-icon {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-input-wrap > .auth-icon {
    position: absolute;
    left: 17px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-3);
    pointer-events: none;
    transition: color .2s ease;
}

.auth-input-wrap:focus-within > .auth-icon {
    color: var(--ink);
}

.auth-reveal .icon-eye-off,
.auth-reveal[aria-pressed="true"] .icon-eye {
    display: none;
}

.auth-reveal[aria-pressed="true"] .icon-eye-off {
    display: block;
}

.auth-input {
    display: block;
    width: 100%;
    height: 54px;
    margin: 0;
    padding: 0 16px 0 46px;
    font: inherit;
    font-size: 15px;
    color: var(--ink);
    background: rgba(255, 255, 255, .55);
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: var(--ctl-radius);
    box-shadow: inset 0 1px 2px rgba(21, 27, 33, .06);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.auth-input::placeholder {
    color: #8a949d;
    opacity: 1;
}

.auth-input:hover {
    background: rgba(255, 255, 255, .68);
}

.auth-input:focus {
    background: rgba(255, 255, 255, .88);
    border-color: #fff;
    box-shadow: 0 0 0 4px rgba(21, 27, 33, .10), inset 0 1px 2px rgba(21, 27, 33, .04);
}

.auth-input.has-toggle {
    padding-right: 54px;
}

/* Keep autofill on-brand; the animation lets JS notice autofill */
@keyframes auth-autofill {
    from { opacity: 1; }
    to { opacity: 1; }
}

.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ink);
    caret-color: var(--ink);
    -webkit-box-shadow: 0 0 0 40px rgba(250, 251, 252, 1) inset !important;
    transition: background-color 9999s ease-out 0s;
    animation: auth-autofill .01s;
}

.auth-reveal {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink-3);
    font-size: 15px;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}

.auth-reveal:hover {
    background: rgba(21, 27, 33, .06);
    color: var(--ink);
}

/* ---------- Buttons ---------- */

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 54px;
    padding: 0 20px;
    border-radius: var(--ctl-radius);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .01em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease, opacity .2s ease;
}

.auth-page button:focus:not(:focus-visible) {
    outline: none;
}

.auth-btn:focus-visible,
.auth-reveal:focus-visible,
.auth-link:focus-visible,
.auth-links a:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
}

.auth-btn-primary {
    margin-top: 26px;
    color: #fff;
    border: 1px solid rgba(0, 0, 0, .55);
    background: linear-gradient(180deg, #2b343c 0%, #141a1f 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .16),
        0 12px 24px -12px rgba(15, 20, 25, .7);
}

.auth-btn-primary i {
    font-size: 14px;
    transition: transform .2s ease;
}

.auth-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .2),
        0 18px 30px -14px rgba(15, 20, 25, .75);
}

.auth-btn-primary:hover i {
    transform: translateX(3px);
}

.auth-btn-primary:active {
    transform: translateY(0);
}

.auth-btn-primary:disabled {
    opacity: .42;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-btn-primary.is-loading {
    pointer-events: none;
}

.auth-btn-primary .auth-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    animation: auth-spin .7s linear infinite;
}

.auth-btn-primary.is-loading .auth-spinner {
    display: inline-block;
}

.auth-btn-primary.is-loading i {
    display: none;
}

@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

.auth-btn-glass {
    color: var(--ink);
    background: rgba(255, 255, 255, .30);
    border: 1px solid rgba(255, 255, 255, .8);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .7),
        0 6px 16px -10px rgba(21, 27, 33, .35);
}

.auth-btn-glass i {
    font-size: 19px;
}

.auth-btn-glass:hover {
    background: rgba(255, 255, 255, .58);
}

.auth-btn-glass:disabled {
    opacity: .6;
    cursor: progress;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 22px 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
}

.auth-divider::before {
    background: linear-gradient(90deg, transparent, rgba(21, 27, 33, .2));
}

.auth-divider::after {
    background: linear-gradient(90deg, rgba(21, 27, 33, .2), transparent);
}

/* "Back to sign in" line at the foot of a card */
.auth-alt {
    margin: 26px 0 0;
    padding-top: 20px;
    border-top: 1px solid rgba(21, 27, 33, .09);
    text-align: center;
    font-size: 14px;
    color: var(--ink-2);
}

.auth-alt .auth-link {
    margin-left: 4px;
    font-size: 14px;
}

/* One-time code input (2FA) */
.auth-input.auth-code {
    padding: 0 16px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: .28em;
    font-variant-numeric: tabular-nums;
}

.auth-input.auth-code::placeholder {
    font-size: 15px;
    font-weight: 400;
    letter-spacing: .01em;
}

/* Checkbox */
.auth-check {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 0;
    font-size: 14px;
    font-weight: 400;
    color: var(--ink-2);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.auth-check input {
    flex: none;
    width: 20px;
    height: 20px;
    margin: 0;
    padding: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, .6);
    border: 1px solid rgba(21, 27, 33, .22);
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}

.auth-check input:hover {
    border-color: rgba(21, 27, 33, .4);
}

.auth-check input:checked {
    border-color: var(--ink);
    background: var(--ink) 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.auth-check input:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.passkey-signin-msg {
    margin: 12px 0 0;
    text-align: center;
    font-size: 13px;
    color: var(--danger);
}

.passkey-signin-msg:empty {
    display: none;
}

/* ---------- Footer ---------- */

.auth-footer {
    grid-area: foot;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 13px;
    color: var(--ink-2);
}

.auth-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: -12px;
}

.auth-links a {
    padding: 6px 12px;
    border-radius: 999px;
    color: var(--ink-2);
    transition: background-color .2s ease, color .2s ease;
}

.auth-links a:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, .45);
}

.auth-legal {
    margin: 0;
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
    .auth-card {
        animation: auth-rise .7s cubic-bezier(.2, .7, .2, 1) .05s both;
    }

    .auth-logo,
    .auth-copy {
        animation: auth-fade .8s ease both;
    }

    .auth-copy {
        animation-delay: .1s;
    }
}

@keyframes auth-rise {
    from {
        opacity: 0;
        transform: translateY(16px) scale(.985);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes auth-fade {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------- Tablet & mobile ---------- */

@media (max-width: 960px) {
    .auth-bg {
        background-position: 62% 50%;
    }

    /* Equal 1fr rows above and below keep the card centred on screen;
       logo pins to the top, footer to the bottom. */
    .auth-shell {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "logo"
            "copy"
            "card"
            "foot";
        grid-template-rows: 1fr auto auto 1fr;
        justify-items: center;
        row-gap: 0;
    }

    .auth-logo-link {
        justify-self: center;
        width: 220px;
        margin: 8px 0 28px;
    }

    /* Headline + lede are desktop-only; keep the row only for the demo badge */
    .auth-copy {
        display: none;
        max-width: none;
        text-align: center;
    }

    .auth-copy.is-demo {
        display: block;
    }

    .auth-demo-wrap {
        margin: 0 0 16px;
    }

    .auth-headline,
    .auth-lede {
        display: none;
    }

    .auth-card {
        align-self: center;
        justify-self: center;
    }

    .auth-footer {
        align-self: end;
        flex-direction: column;
        justify-content: center;
        text-align: center;
        padding-top: 28px;
    }

    .auth-links {
        justify-content: center;
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 30px 22px 24px;
        --card-radius: 24px;
    }

    .auth-card-head h1 {
        font-size: 24px;
    }
}
