@import url("../tokens.css");

.auth-page {
    min-height: 100vh;
    background: var(--bg);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
}

.auth-hero {
    position: relative;
    min-height: 14rem;
    overflow: hidden;
}

.auth-hero__img {
    width: 100%;
    height: 100%;
    min-height: 14rem;
    object-fit: cover;
    object-position: center;
    animation: motion-kenburns 22s ease-in-out infinite alternate;
}

.auth-hero__shade {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, oklch(0% 0 0 / 0.15), oklch(0% 0 0 / 0.82)),
        radial-gradient(ellipse 70% 50% at 80% 20%, oklch(60% 0.22 27 / 0.35), transparent 70%);
}

.auth-hero__copy {
    position: absolute;
    left: 1.25rem;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1;
}

.auth-hero__title {
    margin: 0 0 0.35rem;
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 2.35rem);
    font-weight: 800;
    line-height: 1.1;
    color: var(--text);
}

.auth-hero__lead {
    margin: 0;
    color: oklch(92% 0.02 80 / 0.88);
    font-size: 0.95rem;
}

.auth-main {
    display: grid;
    place-items: center;
    padding: 2rem 1.25rem 2.5rem;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, oklch(45% 0.18 27 / 0.22), transparent 70%),
        var(--bg);
}

.auth-panel {
    width: min(26rem, 100%);
}

.auth-panel__brand {
    display: block;
    margin: 0 auto 1.5rem;
    width: fit-content;
}

.auth-panel__brand img {
    height: 72px;
    width: auto;
    margin: 0 auto;
}

.auth-panel h1 {
    text-align: center;
    font-size: clamp(1.75rem, 5vw, 2.25rem);
    margin-bottom: 0.35rem;
}

.auth-sub {
    text-align: center;
    color: var(--muted);
    margin: 0 0 1.35rem;
    font-size: 0.95rem;
}

.auth-error {
    margin-bottom: 1rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    background: oklch(60% 0.22 27 / 0.12);
    color: var(--text);
    font-size: 0.9rem;
}

.auth-field-hint {
    margin: -0.35rem 0 0;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    background: oklch(60% 0.22 27 / 0.08);
    color: var(--text);
    font-size: 0.82rem;
    line-height: 1.4;
}

.auth-field-hint[hidden] {
    display: none;
}

.auth-form {
    display: grid;
    gap: 0.85rem;
    padding: 1.25rem 1.2rem 1.35rem;
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) + 8px);
    background: oklch(20% 0.03 25 / 0.72);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-soft);
}

.auth-form label {
    display: grid;
    gap: 0.35rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--muted);
}

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"],
.auth-form input[type="tel"] {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) + 2px);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form input:focus-visible {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px oklch(83% 0.14 80 / 0.25);
}

.auth-form__row {
    display: grid;
    gap: 0.85rem;
}

.auth-form__meta {
    margin: 0;
    text-align: right;
    font-size: 0.85rem;
}

.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    font-weight: 500;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text);
}

.auth-check input {
    margin-top: 0.2rem;
    accent-color: var(--accent);
}

.btn--block {
    width: 100%;
    margin-top: 0.25rem;
}

.auth-switch {
    margin: 1.15rem 0 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.92rem;
}

.auth-link {
    color: var(--muted);
    text-decoration: none;
}

.auth-link:hover {
    color: var(--text);
}

.auth-link--gold {
    color: var(--gold);
    font-weight: 700;
}

.auth-profile {
    display: grid;
    gap: 0.65rem;
    margin: 0 0 1.25rem;
    padding: 1rem 1.05rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-card);
}

.auth-profile dt {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.auth-profile dd {
    margin: 0.15rem 0 0;
    font-weight: 600;
}

.auth-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.auth-logout {
    margin: 0;
    text-align: center;
}

@keyframes motion-kenburns {
    from { transform: scale(1); }
    to { transform: scale(1.06); }
}

@media (min-width: 960px) {
    .auth-shell {
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    }

    .auth-hero {
        min-height: 100vh;
    }

    .auth-hero__img {
        min-height: 100vh;
    }

    .auth-hero__copy {
        left: 2.5rem;
        right: 2.5rem;
        bottom: 2.5rem;
        max-width: 28rem;
    }

    .auth-main {
        min-height: 100vh;
        padding: 2.5rem;
    }

    .auth-form__row {
        grid-template-columns: 1fr 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-hero__img {
        animation: none;
    }
}

/* —— MD3 / Stitch login —— */
.auth-page--md3 {
    --bg: var(--md-surface);
    background: var(--md-surface);
    color: var(--text);
}

.auth-page--md3 .auth-main {
    background: linear-gradient(180deg, var(--md-surface-container-low), var(--md-surface-dim));
}

.auth-page--md3 .auth-hero__shade {
    background:
        linear-gradient(180deg, oklch(0% 0 0 / 0.2), oklch(0% 0 0 / 0.78)),
        radial-gradient(ellipse 65% 45% at 70% 25%, oklch(55% 0.2 35 / 0.35), transparent 70%);
}

.auth-hero__back {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 1px solid oklch(92% 0.02 80 / 0.25);
    background: oklch(12% 0.02 40 / 0.45);
    color: var(--text);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.auth-hero__back-short {
    display: none;
}

.auth-hero__lead--desktop {
    display: none;
}

.auth-page--md3 .auth-panel {
    width: min(28rem, 100%);
}

.auth-page--md3 .auth-panel__brand {
    margin: 0 0 1.35rem;
}

.auth-page--md3 .auth-panel__logo {
    height: clamp(2.5rem, 9vw, 3.25rem);
    margin: 0;
}

.auth-page--md3 .auth-panel h1 {
    text-align: left;
    font-family: var(--font-display);
    font-size: clamp(1.65rem, 4.5vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.auth-page--md3 .auth-sub {
    text-align: left;
    color: var(--md-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
}

.auth-page--md3 .auth-form {
    border-color: var(--md-outline-variant);
    border-radius: var(--radius);
    background: var(--md-surface-container);
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.auth-page--md3 .auth-form label {
    color: var(--muted);
    font-family: var(--font-display);
}

.auth-page--md3 .auth-form input[type="email"],
.auth-page--md3 .auth-form input[type="password"],
.auth-page--md3 .auth-form input[type="text"],
.auth-page--md3 .auth-form input[type="tel"] {
    border-color: var(--md-outline-variant);
    border-radius: var(--radius);
    background: var(--md-surface-container-low);
}

.auth-page--md3 .auth-form input:focus-visible {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 2px oklch(70% 0.16 55 / 0.3);
}

.auth-password-wrap {
    position: relative;
    display: block;
}

.auth-password-wrap input {
    padding-right: 2.75rem;
}

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 0.55rem;
    translate: 0 -50%;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--md-outline);
    cursor: pointer;
}

.auth-password-toggle:hover {
    color: var(--md-primary);
}

.auth-password-toggle__icon {
    width: 1.2rem;
    height: 1.2rem;
}

.auth-page--md3 .auth-link--gold,
.auth-page--md3 .auth-link:hover {
    color: var(--md-primary);
}

.auth-page--md3 .g-btn--auth-submit,
.auth-page--md3 .btn--accent.btn--block {
    border-radius: 999px;
    background: linear-gradient(90deg, var(--md-primary-container), var(--md-secondary));
    color: var(--md-on-primary-container);
    font-family: var(--font-display);
    font-weight: 700;
    border: 0;
}

.auth-page--md3 .auth-switch {
    text-align: left;
}

@media (min-width: 960px) {
    .auth-hero__lead--desktop {
        display: block;
    }

    .auth-hero__lead--mobile {
        display: none;
    }

    .auth-hero__back {
        left: 2rem;
        top: 1.5rem;
    }
}

@media (max-width: 959px) {
    .auth-hero__back-short {
        display: inline;
    }

    .auth-hero__back-long {
        display: none;
    }
}
