/* ==========================================================================
   Account pages (log in, sign up, password reset, verification)
   Split layout: a graph-paper panel with real printouts on wide screens, the
   form on the right. Colours come from theme-variables.css only.
   ========================================================================== */

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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.auth {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--text-primary);
    background: var(--bg-primary);
}

@media (min-width: 960px) {
    body.auth {
        grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    }
}

.auth-skip {
    position: absolute;
    left: -9999px;
}

.auth-skip:focus {
    left: 1rem;
    top: 1rem;
    z-index: 10;
    padding: 0.5rem 0.875rem;
    background: var(--bg-card);
    border-radius: 6px;
}

/* ---------- Graph-paper panel ---------- */
.auth-aside {
    display: none;
}

@media (min-width: 960px) {
    .auth-aside {
        position: sticky;
        top: 0;
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        height: 100vh;
        height: 100dvh;
        padding: clamp(2rem, 4vw, 3.5rem);
        overflow: hidden;
        background: var(--jg-stage-surface);
        border-right: 1px solid color-mix(in srgb, var(--jg-accent) 14%, transparent);
    }
}

.auth-aside__words {
    max-width: 30rem;
}

.auth-aside__line {
    margin: 0 0 0.6rem;
    font-family: var(--font-display);
    font-size: clamp(2rem, 3.2vw, 3rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.045em;
    color: var(--text-primary);
    text-wrap: balance;
}

.auth-aside__sub {
    max-width: 38ch;
    margin: 0;
    font-size: 1.0625rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

/* ---------- Form panel ---------- */
.auth-panel {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1.25rem clamp(1.25rem, 4vw, 3rem);
}

.auth-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    min-height: 44px;
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    text-decoration: none;
}

.auth-brand:hover {
    color: var(--text-primary);
}

.auth-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-medium);
    border-radius: 999px;
    cursor: pointer;
}

.auth-theme-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.auth-theme-toggle .fa-sun,
[data-theme="dark"] .auth-theme-toggle .fa-moon {
    display: none;
}

[data-theme="dark"] .auth-theme-toggle .fa-sun {
    display: inline-block;
}

.auth-main {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 6vh, 4rem) 0;
}

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

.auth-title {
    margin: 0 0 0.5rem;
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 2.6rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.035em;
    color: var(--text-primary);
    text-wrap: balance;
}

.auth-lede {
    margin: 0 0 1.75rem;
    color: var(--text-secondary);
}

.auth-card > .auth-title:last-child,
.auth-card > .auth-title + form,
.auth-card > .auth-title + div {
    margin-top: 1.5rem;
}

.auth-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    padding-bottom: 0.25rem;
    font-size: 0.875rem;
}

.auth-foot a {
    color: var(--text-muted);
    text-decoration: none;
}

.auth-foot a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* ---------- Text and links ---------- */
.auth-card p {
    margin: 0 0 1rem;
    color: var(--text-secondary);
}

.auth-card a {
    color: var(--brand-primary-strong);
    text-decoration: underline;
    text-underline-offset: 2px;
}

[data-theme="dark"] .auth-card a {
    color: var(--brand-primary);
}

.auth-card a:hover {
    text-decoration-thickness: 2px;
}

.auth-card h2,
.auth-card h3 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* ---------- Form controls ---------- */
.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0;
}

.auth-field,
.input-container {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.auth-field label,
.input-container > label {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
}

.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="date"],
.auth-card input[type="tel"],
.auth-card input[type="number"],
.auth-card input[type="search"],
.auth-card select,
.auth-card textarea {
    width: 100%;
    min-height: 48px;
    padding: 0.625rem 0.875rem;
    font: inherit;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--input-bg);
    border: 1.5px solid var(--border-strong);
    border-radius: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-card input::placeholder,
.auth-card textarea::placeholder {
    color: var(--text-muted);
}

.auth-card input:focus,
.auth-card select:focus,
.auth-card textarea:focus {
    outline: none;
    border-color: var(--brand-primary-strong);
    box-shadow: 0 0 0 3px var(--brand-primary-20);
}

.auth-card input.error,
.auth-card input[aria-invalid="true"] {
    border-color: var(--error-text);
}

.auth-card input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    margin: 0;
    accent-color: var(--brand-primary-strong);
    cursor: pointer;
}

.field-error,
.error-message,
.errorlist {
    margin: 0;
    padding: 0;
    font-size: 0.875rem;
    color: var(--error-text);
    list-style: none;
}

.error-message:empty {
    display: none;
}

/* ---------- Buttons ---------- */
.auth-card button,
.auth-card .btn,
.auth-card .auth-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0.625rem 1.5rem;
    font: inherit;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    background: var(--brand-primary-strong);
    border: 1.5px solid var(--brand-primary-strong);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.auth-card button:hover:not([disabled]),
.auth-card .btn:hover,
.auth-card .auth-button:hover {
    color: #fff;
    background: color-mix(in srgb, var(--brand-primary-strong) 85%, #000);
    border-color: color-mix(in srgb, var(--brand-primary-strong) 85%, #000);
    text-decoration: none;
}

.auth-card form > button[type="submit"],
.auth-card .button-group > button {
    width: 100%;
}

.auth-card button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.auth-card .secondary-button,
.auth-card .btn-secondary,
.auth-card button.secondary {
    color: var(--text-primary);
    background: transparent;
    border-color: var(--border-strong);
}

.auth-card .secondary-button:hover:not([disabled]),
.auth-card .btn-secondary:hover,
.auth-card button.secondary:hover:not([disabled]) {
    color: var(--text-primary);
    background: var(--bg-secondary);
    border-color: var(--border-strong);
}

.auth-card button:focus-visible,
.auth-card a:focus-visible,
.auth-theme-toggle:focus-visible,
.auth-brand:focus-visible {
    outline: 2px solid var(--brand-primary-strong);
    outline-offset: 2px;
}

.button-group {
    display: flex;
    gap: 0.75rem;
}

/* ---------- Checkbox rows ---------- */
.checkbox-container label,
.remember-forgot label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* ---------- Modals (terms and privacy summaries on sign-up) ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(8, 12, 24, 0.55);
}

.modal.show,
.modal.active,
.modal[style*="block"],
.modal[style*="flex"] {
    display: flex;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 36rem;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.75rem;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: 16px;
}

[data-theme="dark"] .modal-content {
    background: var(--bg-secondary);
}

.modal-content h2 {
    margin: 0 0 1rem;
    font-size: 1.5rem;
}

.modal-content h3 {
    margin: 1.25rem 0 0.35rem;
    font-size: 1.05rem;
}

.close-modal {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-footer {
    margin-top: 1.5rem;
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}

/* ---------- Message pages (email sent, link expired, confirmed) ---------- */
.auth-stack {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.auth-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* Links styled as buttons keep button colours in both themes. */
.auth-card a.auth-button,
[data-theme="dark"] .auth-card a.auth-button {
    color: #fff;
    text-decoration: none;
}

.auth-card a.auth-button.secondary-button,
[data-theme="dark"] .auth-card a.auth-button.secondary-button {
    color: var(--text-primary);
}

/* The form sits on a raised card; the main button is the landing page's yellow pill */
.auth-card {
    padding: clamp(1.5rem, 3vw, 2.25rem);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 28px;
    box-shadow: 0 1px 2px rgba(14, 27, 44, 0.05), 0 28px 56px -36px rgba(14, 27, 44, 0.5);
}

.auth-card form > button[type="submit"],
.auth-card .button-group > button:not(.secondary):not(.secondary-button) {
    min-height: 52px;
    font-weight: 700;
    color: var(--jg-cta-ink);
    background: var(--jg-sun-cta);
    border-color: var(--jg-sun-cta);
    box-shadow: 0 10px 26px -12px rgba(255, 201, 64, 0.8);
}

.auth-card form > button[type="submit"]:hover:not([disabled]),
.auth-card .button-group > button:not(.secondary):not(.secondary-button):hover:not([disabled]) {
    color: var(--jg-cta-ink);
    background: #ffd666;
    border-color: #ffd666;
}

.auth-card input:focus {
    border-color: var(--jg-accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--jg-accent) 20%, transparent);
}

@media (max-width: 959px) {
    .auth-main {
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.25rem;
        border-radius: 22px;
    }
}


/* ==========================================================================
   The logo with living eyes (partials/buddy.html, users/js/auth/buddy.js).
   Kept deliberately quiet: the mark itself, a soft shadow, eyes that follow
   and close. Nothing else moves.
   ========================================================================== */
.auth-stage {
    display: grid;
    flex: 1;
    min-height: 0;
    place-items: center;
}

.jg-buddy {
    width: min(64%, 19rem);
    aspect-ratio: 208 / 214;
    perspective: 1200px;
}

.jg-buddy__rig {
    width: 100%;
    height: 100%;
    transform: rotateX(calc(var(--rx, 0) * 1deg)) rotateY(calc(var(--ry, 0) * 1deg));
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.jg-buddy__svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    filter: drop-shadow(0 18px 26px rgba(14, 27, 44, 0.18));
}

[data-theme="dark"] .jg-buddy__svg {
    filter: drop-shadow(0 22px 34px rgba(0, 0, 0, 0.5));
}

.jg-buddy__ground {
    fill: rgba(14, 27, 44, 0.14);
}

[data-theme="dark"] .jg-buddy__ground {
    fill: rgba(0, 0, 0, 0.45);
}

.jg-buddy__band {
    fill: none;
    stroke: #16243a;
    stroke-width: 9;
    stroke-linecap: round;
}

.jg-buddy__band-shine,
.jg-buddy__cup-shine {
    fill: none;
    stroke: #fff;
    stroke-opacity: 0.28;
    stroke-width: 2;
    stroke-linecap: round;
}

.jg-buddy__cup-shine {
    fill: #fff;
    fill-opacity: 0.18;
    stroke: none;
}

.jg-buddy__yoke {
    fill: #8a97a8;
}

.jg-buddy__cushion {
    fill: #0b1422;
}

.jg-buddy__cap {
    fill: #ffde3e;
    stroke: #0e1b2c;
    stroke-width: 1.5;
}

/* The headphones sit a hair behind the head's tilt, so they read as a separate object */
.jg-buddy__phones {
    transform: translate(calc(var(--ry, 0) * -0.12px), calc(var(--rx, 0) * 0.1px));
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.jg-buddy__svg * {
    transform-box: fill-box;
    transform-origin: center;
}

.jg-buddy__face {
    transform: translate(calc(var(--fx, 0) * 1px), calc(var(--fy, 0) * 1px));
    transition: transform 0.3s ease-out;
}

.jg-buddy__pupil {
    fill: #020202;
    transform-box: view-box;
    transform-origin: 0 0;
    transform: translate(calc(var(--gx, 0) * 1px), calc(var(--gy, 0) * 1px));
    transition: transform 0.2s ease-out;
}

/* Eyes close to a line for blinks and passwords; the right one opens again to peek */
.jg-buddy__eye {
    transition: transform 0.18s ease, opacity 0.15s ease;
}

.jg-buddy.is-blink .jg-buddy__eye {
    transform: scaleY(0.14);
}

/* Passwords: the open eyes fade out and properly closed eyes fade in; peeking opens the right one */
.jg-buddy__shut {
    fill: none;
    stroke: #020202;
    stroke-width: 4.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity 0.18s ease, transform 0.25s ease;
}

.jg-buddy[data-mood="hide"] .jg-buddy__eye,
.jg-buddy[data-mood="peek"] .jg-buddy__eye:not(.jg-buddy__eye--r) {
    opacity: 0;
    transform: scaleY(0.4);
}

.jg-buddy[data-mood="hide"] .jg-buddy__shut,
.jg-buddy[data-mood="peek"] .jg-buddy__shut--l {
    opacity: 1;
    transform: none;
}

/* ---------- Expressions: data-face (the page's feeling) + data-mood (what the eyes are doing) ---------- */
.jg-buddy__mouth,
.jg-buddy__happy-eyes,
.jg-buddy__tear {
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.jg-buddy__smile {
    fill: none;
    stroke: #000;
    stroke-width: 8;
    stroke-linecap: round;
    opacity: 1;
}

.jg-buddy__grin { fill: #020202; }
.jg-buddy__tongue { fill: #ff6b81; }

.jg-buddy__frown {
    fill: none;
    stroke: #000;
    stroke-width: 6;
    stroke-linecap: round;
}

.jg-buddy__happy-eyes {
    fill: none;
    stroke: #020202;
    stroke-width: 5.5;
    stroke-linecap: round;
}

.jg-buddy__glint { fill: #fff; }
.jg-buddy__tear { fill: #7cc8f5; }

/* Rosy cheeks: faint when calm, warmer the happier it gets */
.jg-buddy__cheek {
    fill: #ff8fa3;
    opacity: 0.35;
    transition: opacity 0.3s ease;
}

.jg-buddy[data-face="excited"] .jg-buddy__cheek,
.jg-buddy[data-face="eager"] .jg-buddy__cheek,
.jg-buddy[data-face="celebrate"] .jg-buddy__cheek { opacity: 0.8; }

/* Excited (sign-up) and eager (hovering the main button): a small open smile */
.jg-buddy[data-face="excited"] .jg-buddy__smile,
.jg-buddy[data-face="eager"] .jg-buddy__smile,
.jg-buddy[data-face="celebrate"] .jg-buddy__smile { opacity: 0; }

.jg-buddy[data-face="excited"] .jg-buddy__grin,
.jg-buddy[data-face="eager"] .jg-buddy__grin,
.jg-buddy[data-face="celebrate"] .jg-buddy__grin { opacity: 1; }

/* Excited eyes grow a touch, like a kid spotting something fun */
.jg-buddy[data-face="excited"] .jg-buddy__eye,
.jg-buddy[data-face="eager"] .jg-buddy__eye { transform: scale(1.1); }
.jg-buddy[data-face="eager"] .jg-buddy__grin { transform: scale(1.08); }

/* Celebrate: eyes squeezed shut with joy */
.jg-buddy[data-face="celebrate"] .jg-buddy__eye { opacity: 0; }
.jg-buddy[data-face="celebrate"] .jg-buddy__happy-eyes { opacity: 1; }

/* Sad (lost password, broken link): big puppy eyes, a little pout and one small tear. Sorry, not upset. */
.jg-buddy[data-face="sad"] .jg-buddy__smile { opacity: 0; }
.jg-buddy[data-face="sad"] .jg-buddy__frown,
.jg-buddy[data-face="sad"] .jg-buddy__tear { opacity: 1; }
.jg-buddy[data-face="sad"] .jg-buddy__eye { transform: scale(1.14); }
.jg-buddy[data-face="sad"] .jg-buddy__pupil { translate: 0 1.5px; }
.jg-buddy[data-face="sad"] .jg-buddy__tear { animation: jgb-tear 3.2s ease-in infinite; }

@keyframes jgb-tear {
    0%, 20% { transform: translateY(0) scale(0.6); opacity: 0; }
    35% { opacity: 1; transform: translateY(0) scale(1); }
    85% { opacity: 1; transform: translateY(8px) scale(1); }
    100% { opacity: 0; transform: translateY(11px) scale(0.9); }
}

/* Hopeful: bright eyes and a warm smile, the tear is gone */
.jg-buddy[data-face="hopeful"] .jg-buddy__cheek { opacity: 0.6; }
.jg-buddy[data-face="hopeful"] .jg-buddy__eye { transform: scale(1.06); }

/* While hiding the password the smile shrinks a little */
.jg-buddy[data-mood="hide"] .jg-buddy__smile { transform: scale(0.82, 0.7); }

.jg-buddy.is-wink .jg-buddy__eye--r { transform: scaleY(0.14); }

/* Body language: excited hops now and then, sad sighs, oops shakes, celebrate jumps */
.jg-buddy[data-face="excited"] .jg-buddy__rig { animation: jgb-hop 3.6s cubic-bezier(0.34, 1.56, 0.64, 1) infinite; }
.jg-buddy[data-face="sad"] .jg-buddy__rig { animation: jgb-sigh 5s ease-in-out infinite; }
.jg-buddy[data-face="celebrate"] .jg-buddy__rig,
.jg-buddy.is-jump .jg-buddy__rig { animation: jgb-jump 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 2; }
.jg-buddy[data-mood="oops"] .jg-buddy__rig { animation: jgb-shake 0.45s ease; }

@keyframes jgb-hop {
    0%, 78%, 100% { translate: 0 0; }
    84% { translate: 0 -12px; }
    90% { translate: 0 0; scale: 1.04 0.96; }
    95% { translate: 0 -4px; scale: 1; }
}

@keyframes jgb-sigh {
    0%, 60%, 100% { translate: 0 0; scale: 1; }
    75% { translate: 0 4px; scale: 1.02 0.97; }
}

@keyframes jgb-jump {
    40% { translate: 0 -20px; scale: 0.97 1.04; }
    70% { translate: 0 0; scale: 1.05 0.95; }
}

@keyframes jgb-shake {
    25%, 75% { translate: -4px 0; }
    50% { translate: 4px 0; }
}

/* Confetti bursts out once when celebrating */
.jg-buddy__confetti > * {
    opacity: 0;
}

.jg-buddy.is-confetti .jg-buddy__confetti > * {
    animation: jgb-confetti 1.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.jg-buddy.is-confetti .jg-buddy__confetti > :nth-child(odd) { animation-delay: 0.06s; }

@keyframes jgb-confetti {
    0% { opacity: 0; transform: translate(0, 12px) scale(0.3); }
    20% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(1); }
}

/* Phones: a small copy above the card title */
.jg-buddy--mini {
    display: none;
    width: 4.25rem;
    margin: 0 0 1rem;
}

.jg-buddy--mini .jg-buddy__svg {
    filter: drop-shadow(0 8px 12px rgba(14, 27, 44, 0.2));
}

@media (max-width: 959px) {
    .jg-buddy--mini { display: block; }
}

@media (prefers-reduced-motion: reduce) {
    .jg-buddy__rig,
    .jg-buddy[data-face] .jg-buddy__rig,
    .jg-buddy.is-jump .jg-buddy__rig,
    .jg-buddy[data-mood="oops"] .jg-buddy__rig,
    .jg-buddy.is-confetti .jg-buddy__confetti > *,
    .jg-buddy[data-face="sad"] .jg-buddy__tear {
        transition: none;
        animation: none;
    }
}

/* ==========================================================================
   The form as a book page. Login is the front page; going to sign-up turns
   the page forward, coming back turns it back (cross-document view
   transitions; browsers without them just navigate).
   ========================================================================== */
.auth-book {
    position: relative;
    width: 100%;
    max-width: 30rem;
}

.auth-book .auth-card {
    position: relative;
    max-width: none;
    border-radius: 28px;
    box-shadow:
        5px 5px 0 -1px var(--bg-card),
        5px 5px 0 0 var(--border-light),
        10px 10px 0 -1px var(--bg-card),
        10px 10px 0 0 var(--border-light),
        0 28px 56px -36px rgba(14, 27, 44, 0.5);
    view-transition-name: auth-page;
}

/* A bookmark ribbon in the logo's yellow, tucked under the top edge of the page */
.auth-book__ribbon {
    position: absolute;
    z-index: 1;
    top: -6px;
    right: 2.25rem;
    width: 22px;
    height: 58px;
    background: #ffde3e;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
    filter: drop-shadow(0 4px 4px rgba(14, 27, 44, 0.18));
    pointer-events: none;
}

@media (min-width: 960px) {
    .auth-main {
        align-items: flex-start;
        padding-top: clamp(2rem, 9vh, 5.5rem);
    }
}

@view-transition {
    navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
}

::view-transition-group(auth-page) {
    animation: none;
}

::view-transition-image-pair(auth-page) {
    perspective: 1800px;
}

::view-transition-old(auth-page),
::view-transition-new(auth-page) {
    mix-blend-mode: normal;
    backface-visibility: hidden;
    transform-origin: left center;
}

/* Forward: the old page lifts off the spine and turns over; the next page is underneath */
::view-transition-old(auth-page) {
    z-index: 2;
    animation: jg-page-turn 0.85s cubic-bezier(0.45, 0, 0.2, 1) both;
}

::view-transition-new(auth-page) {
    z-index: 1;
    animation: jg-page-under 0.85s ease both;
}

/* Back: the earlier page swings back over from the left */
html:active-view-transition-type(page-back)::view-transition-old(auth-page) {
    z-index: 1;
    animation: jg-page-under 0.85s ease reverse both;
}

html:active-view-transition-type(page-back)::view-transition-new(auth-page) {
    z-index: 2;
    animation: jg-page-return 0.85s cubic-bezier(0.45, 0, 0.2, 1) both;
}

@keyframes jg-page-turn {
    0% { transform: rotateY(0); filter: brightness(1); }
    100% { transform: rotateY(-180deg); filter: brightness(0.7); }
}

@keyframes jg-page-return {
    0% { transform: rotateY(-180deg); filter: brightness(0.7); }
    100% { transform: rotateY(0); filter: brightness(1); }
}

@keyframes jg-page-under {
    0% { opacity: 0.35; filter: brightness(0.85); }
    100% { opacity: 1; filter: none; }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(auth-page),
    ::view-transition-new(auth-page) {
        animation: none;
    }
}
