/* ==========================================================================
   STAYORA AUTHENTICATION â€” WARM LIMESTONE EDITORIAL FOLIO
   Mobile-First Â· Newsreader + Instrument Sans + IBM Plex Mono
   ========================================================================== */

body:has(.otp-screen) .site-header,
body:has(.otp-screen) .footer {
    display: none;
}

body:has(.otp-screen),
body:has(.auth-page) {
    background-color: #fafaf9;
}

/* Legacy fallback container */
.auth-page {
    min-height: calc(100vh - 130px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background-color: #fafaf9;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-error {
    color: #b91c1c;
    font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.45;
    min-height: 0;
}

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

/* ==========================================================================
   SHARED AUTH SCREEN (OTP, FORGOT, RESET) + SPLIT AUTH (LOGIN, SIGNUP)
   ========================================================================== */

.otp-screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background-color: #fafaf9;
    color: #1f1b16;
    font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.otp-topbar {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 20px 16px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.otp-brand {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: "Instrument Sans", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.035em;
    color: #1b4d7e;
    text-decoration: none;
    transition: color 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.otp-brand:hover {
    color: #153e66;
}

.otp-brand .brand-mark-svg {
    width: 30px;
    height: 27px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    box-shadow: none;
    flex-shrink: 0;
    color: currentColor;
}

.otp-back-link {
    font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    color: #5e554a;
    text-decoration: none;
    padding: 7px 12px;
    border-radius: 8px;
    transition: color 0.16s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

.otp-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px 40px;
}

.otp-card {
    width: 100%;
    max-width: 440px;
    padding: 28px 22px 26px;
    background-color: #ffffff;
    border: 1px solid rgba(31, 27, 22, 0.1);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(31, 27, 22, 0.04), 0 12px 32px rgba(31, 27, 22, 0.04);
    text-align: center;
}

@keyframes authReveal {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.otp-icon-badge {
    width: 48px;
    height: 48px;
    margin: 0 auto 18px;
    border-radius: 12px;
    background-color: #f4f4f2;
    border: 1px solid rgba(31, 27, 22, 0.1);
    color: #1b4d7e;
    display: flex;
    align-items: center;
    justify-content: center;
}

.otp-icon-badge svg {
    width: 22px;
    height: 22px;
}

.otp-title {
    margin: 0 0 8px;
    font-family: 'Newsreader', Georgia, serif;
    font-size: clamp(26px, 4vw, 32px);
    font-weight: 400;
    line-height: 1.14;
    letter-spacing: -0.02em;
    color: #1f1b16;
}

.otp-subtitle {
    margin: 0 auto 20px;
    max-width: 340px;
    font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14.5px;
    font-weight: 400;
    line-height: 1.56;
    color: #5e554a;
}

.otp-email {
    display: block;
    margin-top: 3px;
    font-weight: 600;
    color: #1f1b16;
    word-break: break-word;
}

.otp-ref-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto 22px;
    padding: 6px 12px;
    background-color: #f4f4f2;
    border: 1px solid rgba(31, 27, 22, 0.1);
    border-radius: 8px;
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    line-height: 1.2;
}

.otp-ref-label {
    color: #5e554a;
    font-weight: 400;
}

.otp-ref-value {
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #1f1b16;
}

.otp-form {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.otp-form-stack {
    width: 100%;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.otp-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.otp-field label {
    font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #1f1b16;
}

.otp-field input {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    color: #1f1b16;
    background-color: #fafaf9;
    border: 1px solid rgba(31, 27, 22, 0.18);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.16s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.16s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

.otp-field input::placeholder {
    color: #8c8276;
}

.otp-field input:focus {
    background-color: #ffffff;
    border-color: #1b4d7e;
    box-shadow: 0 0 0 3px rgba(27, 77, 126, 0.14);
}

.otp-field-hint {
    font-size: 12px;
    line-height: 1.45;
    color: #7b7266;
}

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

.otp-forgot-link {
    font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #1b4d7e;
    text-decoration: none;
}

.otp-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: #7b7266;
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11.5px;
    font-weight: 400;
}

.otp-divider::before,
.otp-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: rgba(31, 27, 22, 0.1);
}

.otp-submit-btn {
    width: 100%;
    min-height: 46px;
    padding: 11px 22px;
    font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: -0.008em;
    color: #ffffff;
    background-color: #1b4d7e;
    border: 1px solid #1b4d7e;
    border-radius: 9999px;
    box-shadow: 0 2px 8px rgba(27, 77, 126, 0.2);
    cursor: pointer;
    transition: background-color 0.18s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s cubic-bezier(0.22, 1, 0.36, 1), transform 0.14s cubic-bezier(0.22, 1, 0.36, 1);
}

.otp-submit-btn:active {
    transform: scale(0.985);
}

.otp-google-btn {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 11px 22px;
    background-color: #ffffff;
    border: 1px solid rgba(31, 27, 22, 0.16);
    border-radius: 9999px;
    color: #171512;
    font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14.5px;
    font-weight: 500;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: background-color 0.16s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.16s cubic-bezier(0.22, 1, 0.36, 1), transform 0.14s cubic-bezier(0.22, 1, 0.36, 1);
}

.otp-google-btn:active {
    transform: scale(0.985);
}

.otp-google-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.otp-card-footer {
    margin: 22px 0 0;
    padding-top: 18px;
    border-top: 1px solid rgba(31, 27, 22, 0.09);
    font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: #5e554a;
    text-align: center;
}

.otp-card-footer a {
    color: #1b4d7e;
    font-weight: 600;
    text-decoration: none;
}

.otp-digits-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.otp-digit-box {
    width: 100%;
    aspect-ratio: 1 / 1.12;
    max-height: 56px;
    padding: 0;
    text-align: center;
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 22px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: #1f1b16;
    background-color: #fafaf9;
    border: 1px solid rgba(31, 27, 22, 0.18);
    border-radius: 10px;
    outline: none;
    caret-color: #1b4d7e;
    transition: border-color 0.16s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.16s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

.otp-digit-box:focus {
    background-color: #ffffff;
    border-color: #1b4d7e;
    box-shadow: 0 0 0 3px rgba(27, 77, 126, 0.14);
}

.otp-digit-box.is-filled {
    background-color: #ffffff;
    border-color: rgba(31, 27, 22, 0.36);
}

.otp-inline-error {
    margin: 4px 0 14px;
    min-height: 18px;
    font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #b91c1c;
}

.otp-resend-form {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(31, 27, 22, 0.09);
}

.otp-countdown {
    margin: 0;
    font-size: 13.5px;
    color: #5e554a;
}

.otp-countdown span {
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: #1f1b16;
}

.otp-resend-btn {
    background: none;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #1b4d7e;
    cursor: pointer;
    transition: background-color 0.16s cubic-bezier(0.22, 1, 0.36, 1), color 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

.otp-resend-btn[hidden],
.otp-countdown[hidden] {
    display: none;
}

.otp-footnote {
    margin: 18px 0 0;
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    line-height: 1.55;
    color: #7b7266;
    text-align: center;
}

.otp-footnote a {
    color: #4a433a;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ==========================================================================
   EDITORIAL SPLIT AUTH LAYOUT (LOGIN & SIGNUP)
   ========================================================================== */

.auth-split-screen {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: #fafaf9;
}

.auth-showcase {
    display: none;
}

.auth-stage {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.auth-stage-top {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 20px 16px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.auth-stage-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 16px 36px;
}

.auth-editorial-card {
    text-align: left;
    max-width: 440px;
    padding: 28px 22px 26px;
}

.auth-kicker {
    display: inline-block;
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    font-weight: 500;
    color: #1b4d7e;
    margin-bottom: 8px;
}

.auth-editorial-card .otp-title {
    margin: 0 0 8px;
    text-align: left;
}

.auth-editorial-card .otp-subtitle {
    margin: 0 0 22px;
    max-width: none;
    text-align: left;
}

.auth-editorial-card .otp-card-footer {
    text-align: center;
}

/* Hover states strictly guarded for fine pointers */
@media (hover: hover) and (pointer: fine) {
    .otp-back-link:hover {
        color: #1f1b16;
        background-color: #f4f4f2;
    }

    .otp-field input:hover {
        border-color: rgba(31, 27, 22, 0.32);
    }

    .otp-forgot-link:hover,
    .otp-card-footer a:hover {
        color: #153e66;
        text-decoration: underline;
        text-underline-offset: 2px;
    }

    .otp-submit-btn:hover {
        background-color: #153e66;
        border-color: #153e66;
    }

    .otp-google-btn:hover {
        background-color: #f4f4f2;
        border-color: rgba(31, 27, 22, 0.28);
    }

    .otp-digit-box:hover {
        border-color: rgba(31, 27, 22, 0.32);
    }

    .otp-resend-btn:hover {
        background-color: #f4f4f2;
        color: #153e66;
    }

    .otp-footnote a:hover {
        color: #1f1b16;
    }
}

@media (min-width: 520px) {
    .otp-topbar {
        padding: 24px 32px 8px;
    }

    .otp-card,
    .auth-editorial-card {
        padding: 36px 34px 30px;
    }

    .otp-digits-group {
        gap: 10px;
    }

    .otp-digit-box {
        font-size: 24px;
        max-height: 60px;
    }
}

@media (min-width: 960px) {
    .auth-split-screen {
        grid-template-columns: minmax(420px, 46%) 1fr;
    }

    .auth-showcase {
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 36px 40px 40px;
        background-color: #161513;
        color: #efe9de;
        overflow: hidden;
    }

    .auth-showcase-img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        transform: scale(1.01);
    }

    .auth-showcase-scrim {
        position: absolute;
        inset: 0;
        background:
            linear-gradient(180deg, rgba(20, 17, 15, 0.72) 0%, rgba(20, 17, 15, 0.22) 40%, rgba(20, 17, 15, 0.88) 100%);
    }

    .auth-showcase-top,
    .auth-showcase-bottom {
        position: relative;
        z-index: 2;
    }

    .auth-showcase-brand {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        font-family: "Instrument Sans", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
        font-size: 23px;
        font-weight: 700;
        line-height: 1;
        letter-spacing: -0.035em;
        color: #ffffff;
        text-decoration: none;
    }

    .auth-showcase-brand .brand-mark-svg {
        width: 31px;
        height: 28px;
        color: currentColor;
    }

    .auth-showcase-kicker {
        display: inline-block;
        font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
        font-size: 12px;
        color: #d7bd8f;
        margin-bottom: 10px;
    }

    .auth-showcase-title {
        margin: 0 0 12px;
        font-family: 'Newsreader', Georgia, serif;
        font-size: clamp(30px, 2.8vw, 40px);
        font-weight: 400;
        line-height: 1.12;
        letter-spacing: -0.022em;
        color: #f4eee2;
        max-width: 420px;
    }

    .auth-showcase-copy {
        margin: 0 0 22px;
        font-size: 15px;
        line-height: 1.6;
        color: rgba(244, 238, 226, 0.8);
        max-width: 400px;
    }

    .auth-showcase-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 8px 18px;
        padding-top: 16px;
        border-top: 1px solid rgba(235, 217, 180, 0.2);
        font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
        font-size: 12px;
        color: rgba(235, 217, 180, 0.82);
    }

    .auth-stage-top {
        max-width: none;
        padding: 28px 36px 0;
        justify-content: flex-end;
    }

    .auth-stage-brand-mobile {
        display: none;
    }

    .auth-stage-body {
        padding: 20px 36px 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .otp-card {
        animation: none;
    }
}
