/* ==========================================================
   CDS Journey — Public Auth
   Phase 35 presentation + Phase 34 visual refinement.
   Split-screen editorial + passwordless OTP.
   DOM contract preserved for redesign/js/public/auth.js
   Typography: prefer 400 body / 500 secondary / 600 labels+CTA.
   ========================================================== */

html:has(.rd-auth),
body:has(.rd-auth) {
    height: 100%;
}

/* Auth is a full-page shell — neutralize legacy mainpage html 20px root */
html:has(.rd-auth) {
    font-size: 16px;
}

body:has(.rd-auth) {
    background: var(--rd-color-white, #FFFFFF);
    margin: 0;
}

body:has(.rd-auth) .content-wrapper {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
}

body:has(.rd-auth) .progress-wrap {
    display: none;
}

body:has(.rd-auth) #myNav.overlay,
body:has(.rd-auth) .guest-cart-bar {
    display: none !important;
}

/* Django Debug Toolbar (DEBUG only) — keep off auth presentation */
body:has(.rd-auth) #djDebug,
body:has(.rd-auth) #djDebugToolbar,
body:has(.rd-auth) #djDebugToolbarHandle,
body:has(.rd-auth) .djdt-hidden {
    display: none !important;
}

.rd-auth.auth-page {
    --rd-auth-navy: var(--rd-color-navy, #1A2B4C);
    --rd-auth-olive: var(--rd-color-olive, #4B5320);
    --rd-auth-gold: var(--rd-color-gold, #D4AF37);
    --rd-auth-black: var(--rd-color-black, #1D1D1F);
    --rd-auth-white: var(--rd-color-white, #FFFFFF);
    --rd-auth-light: #F8F9FB;
    --rd-auth-border: #DDE2E6;
    --rd-auth-muted: #6C757D;
    --rd-auth-live: var(--rd-color-live, #A73B2E);

    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--rd-auth-white);
    color: var(--rd-auth-black);
    /* Neutralize legacy mainpage html { font-size: 20px } so rem = design px */
    font-size: 16px;
    font-family: Inter, system-ui, sans-serif;
    font-weight: 400;
}

/* Conditional stepper: Email + OTP; Profile when needs_profile */
.rd-auth__progress {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin: 0 0 1.35rem;
    padding: 0;
    list-style: none;
}

.rd-auth__progress li {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--rd-auth-muted);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.rd-auth__progress li[hidden] {
    display: none !important;
}

.rd-auth__progress li b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    border: 1px solid var(--rd-auth-border);
    font-size: 0.75rem;
    font-weight: 500;
}

.rd-auth__progress li.is-current {
    color: var(--rd-auth-navy);
}

.rd-auth__progress li.is-current b {
    background: var(--rd-auth-navy);
    border-color: var(--rd-auth-navy);
    color: var(--rd-auth-white);
    font-weight: 600;
}

.rd-auth__progress li.is-done {
    color: var(--rd-auth-olive);
}

.rd-auth__progress li.is-done b {
    background: var(--rd-auth-olive);
    border-color: var(--rd-auth-olive);
    color: var(--rd-auth-white);
}

/* —— Full-bleed split —— */
.rd-auth__split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    flex: 1;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

/* —— Editorial (left desktop / below form mobile) —— */
.rd-auth__editorial {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    overflow: hidden;
    background: #1a2332;
}

.rd-auth__editorial-media {
    position: absolute;
    inset: 0;
}

.rd-auth__editorial-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 40%;
}

.rd-auth__editorial-wash {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0) 22%),
        linear-gradient(180deg, rgba(12, 18, 28, 0.22) 0%, rgba(12, 18, 28, 0.12) 42%, rgba(12, 18, 28, 0.7) 100%);
    pointer-events: none;
}

.rd-auth__logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    z-index: 2;
}

.rd-auth__logo img {
    display: block;
    height: auto;
    width: clamp(150px, 11vw, 180px);
}

.rd-auth__logo-plate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 0.8rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 2px 10px rgba(12, 18, 28, 0.12);
}

.rd-auth__logo--on-media {
    position: absolute;
    top: 1.75rem;
    left: 2rem;
}

.rd-auth__logo--on-media img {
    filter: none;
}

.rd-auth__logo--rail {
    display: none;
}

.rd-auth__logo--rail img {
    width: 140px;
}

.rd-auth__editorial-copy {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    flex: 1;
    padding: 3rem 2.5rem 3.25rem;
    color: var(--rd-auth-white);
}

.rd-auth__headline {
    margin: 0;
    max-width: 11ch;
    color: var(--rd-auth-white);
    font-family: Fraunces, Georgia, "Times New Roman", serif;
    font-size: clamp(2.5rem, 4.4vw, 3.5rem);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.28);
}

.rd-auth__headline-accent {
    display: inline;
    color: var(--rd-auth-gold);
    font-style: italic;
    font-weight: 500;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.22);
}

.rd-auth__support {
    margin: 1.1rem 0 0;
    max-width: 24rem;
    color: rgba(255, 255, 255, 0.9);
    font-family: Inter, system-ui, sans-serif;
    font-size: clamp(1.0625rem, 1.2vw, 1.1875rem);
    line-height: 1.55;
    font-weight: 400;
}

.rd-auth__exams {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
    margin: 1.5rem 0 0;
    color: rgba(255, 255, 255, 0.88);
    font-family: Inter, system-ui, sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.rd-auth__exams-dot {
    margin: 0 0.5rem;
    color: var(--rd-auth-gold);
    font-weight: 400;
    opacity: 0.9;
}

/* —— Auth rail (right) —— */
.rd-auth__rail {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding-bottom: 3rem;
    background: var(--rd-auth-light);
}

.rd-auth__rail-top {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    padding: 1.5rem 2rem 0.5rem;
}

.rd-auth__back {
    color: var(--rd-auth-navy);
    font-size: 0.975rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.rd-auth__back:hover,
.rd-auth__back:focus-visible {
    color: var(--rd-auth-olive);
    outline: none;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.rd-auth__main {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 2rem 2rem;
}

.rd-auth__panel {
    width: 100%;
    max-width: 26.5rem;
    padding: 2rem 1.85rem 1.75rem;
    background: var(--rd-auth-white);
    border: 1px solid var(--rd-auth-border);
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(26, 43, 76, 0.05);
}

.rd-auth__title {
    margin: 0;
    color: var(--rd-auth-navy);
    font-family: Fraunces, Georgia, "Times New Roman", serif;
    font-size: clamp(2.35rem, 3vw, 2.75rem);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.rd-auth__lead {
    margin: 0.65rem 0 0;
    color: var(--rd-auth-muted);
    font-size: 1.0625rem;
    line-height: 1.5;
    font-weight: 400;
}

.rd-auth__meta {
    display: block;
    margin: 0.25rem 0 0;
    color: var(--rd-auth-navy);
    font-size: 1rem;
    font-weight: 500;
}

.rd-auth__meta[hidden] {
    display: none !important;
}

.auth-copy__support {
    margin-top: 0;
}

.rd-auth__alerts {
    margin-top: 0.85rem;
}

.auth-status,
.auth-error,
.auth-field-error {
    margin: 0.4rem 0 0;
    font-size: 0.875rem;
    line-height: 1.4;
    font-weight: 400;
}

.auth-status {
    color: var(--rd-auth-olive);
}

.auth-error,
.auth-field-error {
    color: var(--rd-auth-live);
}

#auth-otp-error {
    margin-top: 0.55rem;
}

.rd-auth__step {
    margin-top: 1.35rem;
}

.rd-auth__label {
    display: block;
    margin: 0 0 0.5rem;
    color: var(--rd-auth-navy);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.rd-auth__step .rd-auth__label + .rd-auth__field + .auth-field-error + .rd-auth__label,
.rd-auth__step .rd-auth__label + .rd-auth__field + .rd-auth__label {
    margin-top: 1.15rem;
}

.rd-auth__field {
    position: relative;
    display: flex;
    align-items: center;
}

.rd-auth__field-icon {
    position: absolute;
    left: 1.05rem;
    display: inline-flex;
    color: var(--rd-auth-muted);
    pointer-events: none;
}

.rd-auth__field-icon svg {
    width: 18px;
    height: 18px;
}

.rd-auth__input {
    width: 100%;
    min-height: 4.75rem;
    padding: 1.15rem 1.1rem 1.15rem 3rem;
    border: 1px solid var(--rd-auth-border);
    border-radius: 11px;
    background: var(--rd-auth-white);
    color: var(--rd-auth-black);
    font: inherit;
    font-size: 1.0625rem;
    font-weight: 400;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rd-auth__input::placeholder {
    color: #9AA3AD;
    font-weight: 400;
}

.rd-auth__input:hover {
    border-color: #C5CDD4;
}

.rd-auth__input:focus {
    outline: none;
    border-color: var(--rd-auth-navy);
    box-shadow: 0 0 0 3px rgba(26, 43, 76, 0.1);
}

.rd-auth__input.is-invalid,
.rd-auth__otp.is-invalid .auth-otp__digit {
    border-color: var(--rd-auth-live);
}

.rd-auth__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 4.5rem;
    margin-top: 1.15rem;
    padding: 0.9rem 1.15rem;
    border: 0;
    border-radius: 11px;
    background: var(--rd-auth-gold);
    color: var(--rd-auth-black);
    font: inherit;
    font-size: 1.0625rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.rd-auth__submit:hover,
.rd-auth__submit:focus-visible {
    background: #c9a230;
    color: var(--rd-auth-black);
    outline: none;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.28);
}

.rd-auth__submit:disabled,
.rd-auth__submit[aria-busy="true"] {
    opacity: 0.72;
    cursor: wait;
}

.rd-auth__footnote {
    margin: 0.85rem 0 0;
    text-align: center;
    color: var(--rd-auth-muted);
    font-size: 0.975rem;
    font-weight: 400;
    line-height: 1.4;
}

.rd-auth__trust {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem 0.45rem;
    margin: 1rem 0 0;
    padding-top: 0.95rem;
    border-top: 1px solid var(--rd-auth-border);
    color: var(--rd-auth-muted);
    font-size: 0.8125rem;
    font-weight: 400;
    text-align: center;
}

.rd-auth__trust-icon {
    display: inline-flex;
    color: var(--rd-auth-olive);
    flex-shrink: 0;
    opacity: 0.8;
}

.rd-auth__trust-icon svg {
    width: 16px;
    height: 16px;
}

.rd-auth__trust-sep {
    color: #C5CDD4;
}

.rd-auth__trust-accent {
    color: var(--rd-auth-muted);
    font-weight: 400;
}

.rd-auth__trust-accent::before {
    content: none;
}

.rd-auth__otp {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.7rem;
}

.rd-auth__otp .auth-otp__digit {
    width: 100%;
    min-height: 4.25rem;
    padding: 0;
    border: 1px solid var(--rd-auth-border);
    border-radius: 11px;
    background: var(--rd-auth-white);
    color: var(--rd-auth-navy);
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 1.35rem;
    font-weight: 500;
    text-align: center;
}

.rd-auth__otp .auth-otp__digit:focus {
    outline: none;
    border-color: var(--rd-auth-navy);
    box-shadow: 0 0 0 3px rgba(26, 43, 76, 0.1);
}

.rd-auth__resend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem 0.75rem;
    margin: 1rem 0 0;
    color: var(--rd-auth-muted);
    font-size: 0.875rem;
    font-weight: 400;
}

.rd-auth__resend-wait {
    color: var(--rd-auth-muted);
}

.rd-auth__text-btn {
    display: inline;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--rd-auth-navy);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}

.rd-auth__text-btn:hover,
.rd-auth__text-btn:focus-visible {
    color: var(--rd-auth-olive);
    outline: none;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.rd-auth__text-btn:disabled {
    color: var(--rd-auth-muted);
    cursor: not-allowed;
    text-decoration: none;
    opacity: 0.72;
}

#auth-back-email {
    display: block;
    width: auto;
    margin-top: 1rem;
    text-align: left;
}

.auth-stage.is-changing {
    opacity: 0.55;
    transition: opacity 0.18s ease;
}

.rd-auth__footer {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 50%;
    flex-shrink: 0;
    padding: 0.75rem 2rem 1.25rem;
    text-align: center;
    pointer-events: none;
}

.rd-auth__footer a {
    pointer-events: auto;
}

.rd-auth__footer p {
    margin: 0;
    color: var(--rd-auth-muted);
    font-size: 0.8125rem;
    font-weight: 400;
}

.rd-auth__footer a {
    color: var(--rd-auth-muted);
    text-decoration: none;
    font-weight: 400;
}

.rd-auth__footer a:hover,
.rd-auth__footer a:focus-visible {
    color: var(--rd-auth-navy);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.rd-auth__footer-sep {
    margin: 0 0.35rem;
}

/* —— Tablet / mobile: form first, editorial below —— */
@media (max-width: 900px) {
    .rd-auth__split {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .rd-auth__rail {
        order: 1;
        min-height: auto;
        padding-bottom: 0;
        background: var(--rd-auth-white);
    }

    .rd-auth__editorial {
        order: 2;
        min-height: 16rem;
        max-height: 20rem;
    }

    .rd-auth__logo--on-media {
        display: none;
    }

    .rd-auth__logo--rail {
        display: inline-flex;
    }

    .rd-auth__rail-top {
        justify-content: space-between;
        padding: 1rem 1.15rem 0.25rem;
    }

    .rd-auth__main {
        align-items: flex-start;
        padding: 1rem 1.15rem 1.25rem;
    }

    .rd-auth__panel {
        max-width: none;
        padding: 1.35rem 1.15rem 1.25rem;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .rd-auth__input {
        min-height: 4.25rem;
    }

    .rd-auth__submit {
        min-height: 4rem;
    }

    .rd-auth__editorial-copy {
        padding: 1.35rem 1.15rem 1.5rem;
    }

    .rd-auth__headline {
        font-size: 1.85rem;
        max-width: none;
        font-weight: 600;
    }

    .rd-auth__support {
        font-size: 0.975rem;
        max-width: none;
        font-weight: 400;
    }

    .rd-auth__exams {
        margin-top: 1rem;
        font-size: 0.8125rem;
        font-weight: 500;
    }

    .rd-auth__editorial-wash {
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 18%),
            linear-gradient(180deg, rgba(12, 18, 28, 0.18) 0%, rgba(12, 18, 28, 0.78) 100%);
    }

    .rd-auth__footer {
        position: static;
        width: 100%;
        order: 3;
        padding: 1rem 1.15rem 1.35rem;
        border-top: 1px solid var(--rd-auth-border);
        background: var(--rd-auth-white);
        pointer-events: auto;
    }

    .rd-auth.auth-page {
        display: flex;
        flex-direction: column;
    }

    .rd-auth__split {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: auto;
    }
}

@media (max-width: 480px) {
    .rd-auth__logo img {
        width: 140px;
    }

    .rd-auth__back {
        font-size: 0.9rem;
        font-weight: 500;
    }

    .rd-auth__title {
        font-size: 2rem;
        font-weight: 600;
    }

    .rd-auth__lead {
        font-size: 1rem;
    }

    .rd-auth__input {
        min-height: 4rem;
        font-size: 1rem;
    }

    .rd-auth__submit {
        min-height: 3.75rem;
        font-size: 1rem;
    }

    .rd-auth__otp {
        gap: 0.45rem;
    }

    .rd-auth__otp .auth-otp__digit {
        min-height: 3.25rem;
        font-size: 1.2rem;
        font-weight: 500;
    }

    .rd-auth__editorial {
        min-height: 13rem;
        max-height: 16rem;
    }

    .rd-auth__main {
        padding: 0.75rem 0.85rem 1rem;
    }

    .rd-auth__panel {
        padding: 1.05rem 0.85rem 1rem;
    }
}
