/* ==========================================================================
   PhotoZone Graphy authentication UI  (login, signup, forgot-password)
   Full-bleed split layout: photo on the left, form on the right.
   Same visual language as support-nudge.js / login-nudge.js:
   white surface, cobalt accent, Manrope.
   The rotating sentence on the photo comes from js/auth-captions.js.
   Class names are unchanged from the previous stylesheet.
   ========================================================================== */

:root {
    color-scheme: light;
    --bg: #ffffff;
    --bg-sunk: #f3f6fb;
    --surface: #ffffff;
    --surface-solid: #ffffff;
    --line: #e5e9f0;
    --line-strong: #d3dae6;
    --ink: #121620;
    --ink-2: #2b3342;
    --ink-3: #566072;
    --ink-4: #8a93a3;
    --accent: #2855a0;
    --accent-ink: #214a8f;
    --accent-deep: #16305f;
    --accent-tint: rgba(40, 85, 160, .07);
    --accent-tint-strong: rgba(40, 85, 160, .15);
    --good: #1f7a4d;
    --good-tint: rgba(31, 122, 77, .09);
    --warn: #b3412f;
    --warn-tint: rgba(179, 65, 47, .08);
    --info-tint: rgba(40, 85, 160, .07);
    --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; /* one family on purpose */
    --r-sm: 10px;
    --r: 12px;
    --r-lg: 22px;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

html { background: #fff; }

body {
    min-height: 100vh;
    min-height: 100dvh;
    background: #fff;
    color: var(--ink-2);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; }

a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-tint-strong); color: var(--accent-deep); }

/* --------------------------------------------------------------------------
   Full-viewport split. The document itself never scrolls on desktop; the form
   column scrolls inside itself when its content is taller than the window.
   -------------------------------------------------------------------------- */
.split-shell {
    display: grid;
    grid-template-columns: minmax(360px, 47%) minmax(0, 53%);
    grid-template-rows: minmax(0, 1fr);
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   Photo panel
   -------------------------------------------------------------------------- */
.split-image {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    isolation: isolate;
    background: #1b2433;
}

.split-image > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    color: transparent;
}

.split-image::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(10, 16, 30, .24) 0%, rgba(10, 16, 30, 0) 34%, rgba(10, 16, 30, .8) 100%);
}

/* Rotating sentence, injected by js/auth-captions.js */
.split-image-caption {
    position: absolute;
    z-index: 2;
    left: clamp(24px, 3.6vw, 52px);
    right: clamp(24px, 3.6vw, 52px);
    bottom: clamp(26px, 4vw, 52px);
    max-width: 15em;
    pointer-events: none;
}

.split-image-caption .cap {
    display: block;
    color: #fff;
    font-size: clamp(1.4rem, 2.4vw, 2.1rem);
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: -.03em;
    text-shadow: 0 2px 18px rgba(10, 16, 30, .5);
    opacity: 1;
    transform: none;
    transition: opacity .45s ease, transform .55s cubic-bezier(.2, .8, .2, 1);
}
.split-image-caption .cap.is-out { opacity: 0; transform: translateY(-8px); }
.split-image-caption .cap.is-pre { opacity: 0; transform: translateY(10px); transition: none; }

.split-image-brand {
    position: absolute;
    top: clamp(20px, 3vw, 36px);
    left: clamp(20px, 3.2vw, 44px);
    z-index: 3;
    display: inline-flex;
    align-items: center;
    padding: 9px 15px;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.split-image-brand img {
    position: static;
    display: block;
    width: auto;
    height: 22px;
    max-width: 180px;
    object-fit: contain;
}

/* --------------------------------------------------------------------------
   Form column
   -------------------------------------------------------------------------- */
.split-form-col {
    position: relative;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
    padding: clamp(24px, 5vw, 72px);
    background: #fff;
}

.split-form-col::-webkit-scrollbar { width: 8px; }
.split-form-col::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border: 2px solid #fff;
    border-radius: 99px;
}

/* No inner card: the column itself is the surface. */
.form-shell {
    position: relative;
    width: min(100%, 410px);
    margin: auto 0;
    padding: 0;
    border: 0;
    background: transparent;
    animation: formIn .5s ease both;
}

@keyframes formIn { from { opacity: 0; } to { opacity: 1; } }

.auth-signup .form-shell { width: min(100%, 520px); }

.form-shell > h2 {
    margin-bottom: 6px !important;
    color: var(--ink) !important;
    font-size: clamp(1.5rem, 2.3vw, 1.85rem) !important;
    font-weight: 800 !important;
    line-height: 1.18;
    letter-spacing: -.03em;
}

.form-shell > h2 + p {
    margin-bottom: 22px !important;
    color: var(--ink-3) !important;
    font-size: .92rem !important;
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Progress
   -------------------------------------------------------------------------- */
.step-progress-label {
    display: block;
    margin-bottom: 10px;
    color: var(--accent);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.step-progress {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 26px;
}

.step-dot {
    flex: 1;
    height: 4px;
    overflow: hidden;
    border-radius: 99px;
    background: var(--line);
    transition: background .25s ease;
}
.step-dot.done { background: rgba(40, 85, 160, .45); }
.step-dot.current { background: var(--accent); }

/* --------------------------------------------------------------------------
   Intro (signup step 0)
   -------------------------------------------------------------------------- */
.intro-panel { text-align: left; }

.intro-eyebrow {
    display: inline-flex;
    align-items: center;
    margin-bottom: 14px;
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--accent-tint);
    color: var(--accent);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}
.intro-eyebrow::before { content: none; }

.intro-title {
    margin-bottom: 12px;
    color: var(--ink);
    font-size: clamp(1.75rem, 3vw, 2.4rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.04em;
}

.intro-sub {
    max-width: 40ch;
    margin-bottom: 28px;
    color: var(--ink-3);
    font-size: .96rem;
    line-height: 1.65;
}

.intro-actions { display: flex; flex-direction: column; gap: 10px; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-height: 48px;
    padding: 11px 18px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r);
    background: #fff;
    color: var(--ink);
    font-family: var(--font);
    font-size: .9rem;
    font-weight: 700;
    letter-spacing: -.005em;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn:hover { background: #f6f8fb; border-color: #c4ccda; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 10px 22px -10px rgba(40, 85, 160, .7);
}
.btn-primary:hover:not(:disabled) { border-color: var(--accent-ink); background: var(--accent-ink); transform: translateY(-1px); }
.btn-primary:disabled:hover { background: var(--accent); border-color: var(--accent); }

.btn-dark { border-color: var(--ink); background: var(--ink); color: #fff; }
.btn-dark:hover { border-color: #232a38; background: #232a38; }

.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-3); }
.btn-ghost:hover { border-color: transparent; background: #f1f4f9; color: var(--ink); }

.btn-google, .btn-discord { background: #fff; border-color: var(--line-strong); color: var(--ink); }
.btn-google svg, .btn-discord svg { flex: 0 0 auto; }

/* Google + Discord side by side (login). Stays stacked where :has() is unsupported. */
.form-shell > div:has(> .btn-google + .btn-discord) { flex-direction: row !important; gap: 10px !important; }
.form-shell > div:has(> .btn-google + .btn-discord) .btn {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    font-size: .82rem;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Fields
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }

.field label { color: var(--ink); font-size: .8rem; font-weight: 700; }

.field-wrap { position: relative; }

.field input,
.field select,
.attr-subselect input,
.attr-subselect select {
    width: 100%;
    min-height: 48px;
    padding: 11px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r);
    outline: 0;
    background: #fff;
    color: var(--ink);
    font-family: var(--font);
    font-size: .92rem;
    font-weight: 500;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.field input::placeholder,
.attr-subselect input::placeholder { color: #a0a9b8; font-weight: 400; }

.field input:hover, .field select:hover,
.attr-subselect input:hover, .attr-subselect select:hover { border-color: #b9c3d3; }

.field input:focus, .field select:focus,
.attr-subselect input:focus, .attr-subselect select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-tint-strong);
}

.field-wrap input { padding-right: 48px; }

.field input.is-valid { border-color: var(--good); }
.field input.is-invalid { border-color: var(--warn); }

.field-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 14px;
    color: var(--ink-4);
    font-size: .74rem;
}
.field-hint.ok { color: var(--good); }
.field-hint.bad { color: var(--warn); }
.hint-dot { width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: currentColor; }

.pw-toggle {
    position: absolute;
    top: 50%;
    right: 7px;
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ink-4);
    cursor: pointer;
    transform: translateY(-50%);
    transition: color .15s ease, background .15s ease;
}
.pw-toggle:hover { background: #f1f4f9; color: var(--ink); }

/* Username suggestions */
.suggest-wrap { margin-top: 4px; }
.suggest-label { margin-bottom: 7px; color: var(--ink-4); font-size: .74rem; }
.suggest-chips { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
    padding: 5px 11px;
    border: 1px solid var(--accent-tint-strong);
    border-radius: 99px;
    background: var(--accent-tint);
    color: var(--accent);
    font-family: var(--font);
    font-size: .74rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s ease;
}
.chip:hover { background: var(--accent-tint-strong); }

/* Checkbox rows */
.terms-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: #f7f9fc;
    transition: border-color .15s ease, background .15s ease;
}
.terms-row:hover { border-color: var(--line-strong); }
.terms-row.highlight { border-color: rgba(179, 65, 47, .4); background: var(--warn-tint); }

.terms-row input[type="checkbox"] {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    margin-top: 2px;
    accent-color: var(--accent);
    cursor: pointer;
}

.terms-label { color: var(--ink-3); font-size: .8rem; line-height: 1.55; cursor: pointer; }
.terms-label a { color: var(--accent); font-weight: 700; text-decoration: underline; }
.terms-error { display: none; margin: -8px 0 14px; color: var(--warn); font-size: .78rem; }
.terms-error.show { display: block; }

/* Messages */
.msg-banner {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 16px;
    padding: 11px 14px;
    border: 1px solid;
    border-radius: var(--r);
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.5;
}
.msg-banner.error { border-color: rgba(179, 65, 47, .25); background: var(--warn-tint); color: var(--warn); }
.msg-banner.success { border-color: rgba(31, 122, 77, .25); background: var(--good-tint); color: var(--good); }
.msg-banner.info { border-color: var(--accent-tint-strong); background: var(--info-tint); color: var(--accent-ink); }
.msg-banner svg { flex: 0 0 auto; margin-top: 2px; }

/* Cloudflare Turnstile */
.cf-turnstile { width: 100%; max-width: 100%; overflow: hidden; }

/* OTP */
.otp-input {
    width: 100%;
    min-height: 64px;
    margin-bottom: 12px;
    padding: 12px 10px 12px 22px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    outline: 0;
    background: #fff;
    color: var(--ink);
    font-family: var(--font);
    font-size: 1.7rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: .38em;
    text-align: center;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.otp-input::placeholder { color: #c3cad6; }
.otp-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint-strong); }
.otp-timer { margin-bottom: 16px; color: var(--ink-4); font-size: .78rem; font-variant-numeric: tabular-nums; text-align: center; }
.otp-timer span { color: var(--warn); font-weight: 700; }

/* Signup step 4: attribution */
.attr-group { margin-bottom: 18px; }
.attr-group-label { display: block; margin-bottom: 10px; color: var(--ink); font-size: .82rem; font-weight: 700; }
.attr-chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.attr-chip {
    padding: 8px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 99px;
    background: #fff;
    color: var(--ink-2);
    font-family: var(--font);
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.attr-chip:hover { border-color: var(--accent); }
.attr-chip.selected { border-color: var(--accent); background: var(--accent); color: #fff; }

.attr-subselect {
    display: none;
    margin-top: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: #f7f9fc;
}
.attr-subselect.show { display: block; }
.attr-sub-title { margin-bottom: 8px; color: var(--ink-3); font-size: .76rem; font-weight: 700; }
.ref-skip-note { margin: -4px 0 16px; color: var(--ink-4); font-size: .78rem; line-height: 1.6; }
.ref-skip-note a { color: var(--ink-3); font-weight: 700; text-decoration: underline; }

.amb-search-wrap { position: relative; }

.amb-results {
    display: none;
    max-height: 230px;
    margin-top: 9px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: #fff;
    box-shadow: 0 12px 30px rgba(18, 28, 50, .1);
}
.amb-results.show { display: block; }

.amb-result-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    transition: background .12s ease;
}
.amb-result-row:last-child { border-bottom: 0; }
.amb-result-row:hover { background: #f7f9fc; }
.amb-result-row.selected { background: var(--accent-tint); }
.amb-avatar { width: 35px; height: 35px; flex: 0 0 auto; border-radius: 50%; background: var(--line); object-fit: cover; }
.amb-result-name { color: var(--ink); font-size: .82rem; font-weight: 700; }
.amb-result-loc { color: var(--ink-4); font-size: .73rem; }

.amb-selected-pill {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 9px 12px;
    border: 1px solid var(--accent-tint-strong);
    border-radius: var(--r);
    background: var(--accent-tint);
    color: var(--accent-ink);
    font-size: .8rem;
    font-weight: 700;
}
.amb-selected-pill.show { display: flex; }
.amb-selected-pill button { margin-left: auto; padding: 2px; border: 0; background: none; color: var(--accent-ink); font-size: 1rem; line-height: 1; cursor: pointer; }

.step-nav { display: flex; gap: 10px; margin-top: 18px; }
.step-nav .btn { flex: 1; }

.auth-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    color: var(--ink-4);
    font-size: .82rem;
}
.auth-links a { color: var(--ink-3); font-weight: 700; }
.auth-links a:hover { color: var(--accent); }
.auth-links .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }

/* Lockout and signed-in states */
.blocked-state, .status-card { text-align: center; }
.blocked-icon { display: block; margin-bottom: 14px; font-size: 2rem; }
.blocked-title { margin-bottom: 8px; color: var(--ink); font-size: 1.35rem; font-weight: 800; letter-spacing: -.03em; }
.blocked-msg { margin-bottom: 18px; color: var(--ink-3); font-size: .86rem; line-height: 1.65; }
.blocked-countdown { margin-bottom: 18px; color: var(--accent); font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.status-card h2 { margin-bottom: 8px; }
.status-card p { margin-bottom: 18px; color: var(--ink-3); font-size: .9rem; }

/* --------------------------------------------------------------------------
   Signup is the longest flow: use the width to keep it short
   -------------------------------------------------------------------------- */
.auth-signup .field { margin-bottom: 14px; }
.auth-signup .step-progress { margin-bottom: 22px; }
.auth-signup .attr-group { margin-bottom: 15px; }

@media (min-width: 681px) {
    .auth-signup #step1Form,
    .auth-signup #step2Form {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 13px;
    }

    .auth-signup #step1Form > .terms-row,
    .auth-signup #step1Form > .terms-error,
    .auth-signup #step1Form > .btn,
    .auth-signup #step2Form > .field:first-of-type,
    .auth-signup #step2Form > .cf-turnstile,
    .auth-signup #step2Form > .step-nav {
        grid-column: 1 / -1;
    }
}

/* Short laptop windows: tighten spacing so most forms fit without scrolling */
@media (min-width: 901px) and (max-height: 760px) {
    .split-form-col { padding-top: 20px; padding-bottom: 20px; }
    .field { margin-bottom: 11px; }
    .step-progress { margin-bottom: 18px; }
    .form-shell > h2 + p { margin-bottom: 16px !important; }
    .terms-row { margin-bottom: 12px; padding-top: 9px; padding-bottom: 9px; }
    .auth-links { margin-top: 14px; }
}

/* --------------------------------------------------------------------------
   Tablet and phone: photo strip on top, form below, the whole page scrolls
   (normal document scrolling, no nested scroll areas on touch devices).
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    html, body {
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    body { min-height: 100vh; min-height: 100dvh; }

    .split-shell {
        grid-template-columns: 1fr;
        grid-template-rows: clamp(160px, 28vh, 260px) auto;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        overflow: visible;
    }

    .split-image { height: clamp(160px, 28vh, 260px); }

    .split-image-caption { left: 22px; right: 22px; bottom: 20px; max-width: 18em; }
    .split-image-caption .cap { font-size: 1.15rem; line-height: 1.22; }

    .split-image-brand { top: 18px; left: 22px; padding: 8px 13px; }
    .split-image-brand img { height: 20px; }

    .split-form-col {
        align-items: flex-start;
        justify-content: center;
        min-height: 0;
        overflow: visible;
        overscroll-behavior: auto;
        padding: 28px 20px max(34px, env(safe-area-inset-bottom));
    }

    .form-shell, .auth-signup .form-shell { width: min(100%, 480px); margin: 0 auto; }

    .field input, .field select,
    .attr-subselect input, .attr-subselect select { font-size: 16px; }
}

@media (max-width: 680px) {
    .auth-signup #step1Form,
    .auth-signup #step2Form { display: block; }
}

@media (max-width: 520px) {
    .split-shell { grid-template-rows: clamp(140px, 24vh, 190px) auto; }
    .split-image { height: clamp(140px, 24vh, 190px); }
    .split-image-caption { bottom: 16px; }
    .split-image-caption .cap { font-size: 1.05rem; }
    .split-form-col { padding: 24px 16px max(30px, env(safe-area-inset-bottom)); }
    .step-nav { flex-direction: column-reverse; }
    .otp-input { font-size: 1.4rem; letter-spacing: .28em; }
    .intro-title { font-size: 1.65rem; }
}

@media (max-width: 400px) {
    .form-shell > div:has(> .btn-google + .btn-discord) { flex-direction: column !important; }
}

/* Turnstile is 300px wide; shrink it a touch on very small phones instead of clipping it. */
@media (max-width: 350px) {
    .split-form-col { padding-left: 12px; padding-right: 12px; }
    .cf-turnstile { transform: scale(.9); transform-origin: left top; height: 59px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}
