/* justqrer Secrets — Uber/Clinique auth shell (parity with Pipelines / Chat / SSO).
 * Hex remap of Infisical lime → #0B3D2E is done in rebrand.py; this file adds
 * font, wash, lockup card, landing hero, buttons, focus rings. Cache-bust: ?v=uber4
 *
 *   primary #0B3D2E   hover #083028   accent #2BB5A0   wash #F5F0E8   muted #5A7A6E
 *
 * Auth hooks (rebrand.py patch_lockup / patch_login_shell):
 *   .jq-auth-card > .jq-lockup > img.jq-logo (square mark.png, bottom-right)
 *                         + span.jq-product (bottom-left)
 * Stronger top-left green wash masks any Replicate-baked justqrer wordmark in landing.jpg.
 *   .jq-auth-card > .jq-auth-form  (login form column)
 * Scoped with :has(.jq-lockup) / :has(.jq-auth-card) so the app shell stays dark.
 *
 * Landing hero is same-origin (portal /v1/brand currently returns SPA HTML):
 *   /justqr/landing.jpg  ← baked from data/justqrer/landing/infisical.jpg
 */

@font-face {
    font-family: "Nunito";
    src: url("/justqr/Nunito-Variable.ttf") format("truetype");
    font-weight: 200 1000;
    font-style: normal;
    font-display: swap;
}

:root {
    --font-inter: "Nunito", "Inter", sans-serif;
    --font-sans: "Nunito", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    --jq-primary: #0B3D2E;
    --jq-primary-hover: #083028;
    --jq-primary-light: #2BB5A0;
    --jq-accent: #2BB5A0;
    --jq-accent-ink: #168676;
    --jq-wash: #F5F0E8;
    --jq-primary-ultra: #EDF5F2;
    --jq-secondary: #1e293b;
    --jq-text: #0B3D2E;
    --jq-muted: #5A7A6E;
    --jq-border: #d9e3de;
    --jq-radius: 12px;
    --jq-ring: 0 0 0 4px rgb(43 181 160 / 28%);
    --jq-ease: cubic-bezier(0.22, 1, 0.36, 1);
    /* Same-origin Replicate landing (infisical.jpg); do not use portal.justqrer.com here. */
    --jq-landing: url("/justqr/landing.jpg");
}

html,
body,
button,
input,
select,
textarea {
    font-family: "Nunito", "Inter", sans-serif;
}

::selection {
    background: var(--jq-wash);
    color: var(--jq-text);
}

:focus-visible {
    outline-color: var(--jq-accent);
}

/* Hide outbound stock Infisical marketing logos on auth shells */
div.min-h-screen:has(.jq-lockup) a[href^="https://infisical.com"] {
    display: none !important;
}

/* Primary solid buttons: white label on green (remap alone leaves lime-on-green) */
.bg-primary,
.bg-primary-500,
.bg-primary-600,
.hover\:bg-primary:hover,
.hover\:bg-primary-400:hover,
.hover\:bg-primary-500:hover {
    color: #fff !important;
}

/* ── Auth page: wash + green atmospherics ────────────────────────────────── */
html:has(.jq-lockup),
body:has(.jq-lockup) {
    background: var(--jq-wash) !important;
}

div.min-h-screen:has(.jq-lockup),
div.min-h-screen:has(.jq-auth-card) {
    position: relative;
    isolation: isolate;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    max-height: none !important;
    min-height: 100dvh !important;
    padding: 24px !important;
    overflow-y: auto !important;
    background-color: var(--jq-wash) !important;
    background-image:
        radial-gradient(60rem 38rem at 8% -10%, rgba(43, 181, 160, 0.20), transparent 62%),
        radial-gradient(52rem 34rem at 108% 108%, rgba(11, 61, 46, 0.16), transparent 60%),
        radial-gradient(28rem 20rem at 92% 6%, rgba(43, 181, 160, 0.10), transparent 70%) !important;
    color: var(--jq-text);
    -webkit-font-smoothing: antialiased;
}

/* faint scan-grid, masked so it fades toward the edges */
div.min-h-screen:has(.jq-lockup)::before,
div.min-h-screen:has(.jq-auth-card)::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(11, 61, 46, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(11, 61, 46, 0.045) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 72%);
    mask-image: radial-gradient(ellipse at center, #000 20%, transparent 72%);
}

/* Hide leftover top logo link chrome when we inject the card lockup */
div.min-h-screen:has(.jq-auth-card) > a:has(img[src*="gradientLogo"]),
div.min-h-screen:has(.jq-auth-card) > a:has(.jq-lockup):not(.jq-auth-card *) {
    display: none !important;
}

/* ── Split auth card (login) ─────────────────────────────────────────────── */
.jq-auth-card {
    position: relative;
    display: grid !important;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    grid-template-rows: auto 1fr;
    width: 100%;
    max-width: 960px !important;
    min-height: 560px;
    margin: 0 auto;
    padding: 0 !important;
    overflow: hidden;
    border-radius: 28px !important;
    background: #fff !important;
    border: 1px solid rgba(11, 61, 46, 0.08);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.8) inset,
        0 2px 6px rgba(11, 61, 46, 0.06),
        0 24px 48px -12px rgba(11, 61, 46, 0.22),
        0 60px 120px -40px rgba(11, 61, 46, 0.28) !important;
    animation: jq-rise 0.7s var(--jq-ease) both;
}

/* Brand panel: Replicate landing cover + green wash.
 * Extra top-left radial + heavier top stop masks Replicate-baked justqrer wordmark. */
.jq-auth-card::before {
    content: "";
    grid-column: 1;
    grid-row: 1 / 3;
    z-index: 0;
    background:
        radial-gradient(22rem 16rem at 0% 0%, rgb(8 48 40 / 94%), transparent 68%),
        radial-gradient(14rem 10rem at 12% 8%, rgb(11 61 46 / 88%), transparent 72%),
        linear-gradient(
            180deg,
            rgba(11, 61, 46, 0.82) 0%,
            rgba(11, 61, 46, 0.62) 22%,
            rgba(11, 61, 46, 0.72) 48%,
            rgba(8, 48, 40, 0.92) 100%
        ),
        radial-gradient(22rem 18rem at 100% 0%, rgba(43, 181, 160, 0.38), transparent 65%),
        radial-gradient(18rem 18rem at 0% 100%, rgba(43, 181, 160, 0.16), transparent 70%),
        var(--jq-landing) center / cover no-repeat,
        linear-gradient(160deg, #0F4D3B 0%, #0B3D2E 48%, #083028 100%);
}

/* support line above bottom chrome (pill + mark) */
.jq-auth-card::after {
    content: "Secrets, keys and config\A for your justqrer workspace.";
    white-space: pre-line;
    grid-column: 1;
    grid-row: 2;
    align-self: end;
    z-index: 1;
    margin: 0 40px 108px;
    padding-top: 22px;
    border-top: 1px solid rgba(245, 240, 232, 0.18);
    color: rgba(245, 240, 232, 0.86);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: -0.005em;
    animation: jq-fade 1s 0.35s var(--jq-ease) both;
}

/* Lockup spans brand panel: product pill bottom-left, square mark bottom-right */
.jq-auth-card > .jq-lockup {
    grid-column: 1;
    grid-row: 1 / 3;
    position: relative;
    z-index: 2;
    display: block !important;
    width: auto;
    height: auto;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none;
    animation: jq-fade 0.9s 0.15s var(--jq-ease) both;
}

.jq-auth-card > .jq-auth-form {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
    z-index: 1;
    width: 100%;
    max-width: none !important;
    margin: 0 !important;
    padding: 48px 48px 44px !important;
    background: #fff;
    animation: jq-fade 0.8s 0.25s var(--jq-ease) both;
}

/* Form column content: stretch to full card width (stock uses w-1/4) */
.jq-auth-card .jq-auth-form form,
.jq-auth-card .jq-auth-form > div,
.jq-auth-card .jq-auth-form .mx-auto {
    width: 100% !important;
    max-width: none !important;
    align-items: stretch !important;
}

.jq-auth-card .jq-auth-form [class*="min-w-"],
.jq-auth-card .jq-auth-form [class*="w-1/4"],
.jq-auth-card .jq-auth-form [class*="lg:w-1/6"] {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
}

/* Declutter stock SAML / OIDC / LDAP / Google / GitHub / GitLab — keep email+password */
.jq-auth-card .jq-auth-form form > div:has(> button[type="button"]),
.jq-auth-card .jq-auth-form form > div:has(button[aria-label*="Google"]),
.jq-auth-card .jq-auth-form form > div:has(button[aria-label*="GitHub"]),
.jq-auth-card .jq-auth-form form > div:has(button[aria-label*="GitLab"]),
.jq-auth-card button[aria-label*="Google"],
.jq-auth-card button[aria-label*="GitHub"],
.jq-auth-card button[aria-label*="GitLab"] {
    display: none !important;
}

/* Hide orphaned "OR" divider once IdP rows are gone */
.jq-auth-card .jq-auth-form form > div:has(> .text-xs):not(:has(input)):not(:has(button[type="submit"])) {
    display: none !important;
}

/* Lockup mark + product pill (also used on non-card auth pages) */
.jq-lockup {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.jq-logo {
    display: block;
    width: 56px;
    height: 56px !important;
    object-fit: contain;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.28));
}

/* Square mark bottom-right on split brand panel (white tile + green JQ) */
.jq-auth-card > .jq-lockup .jq-logo {
    position: absolute;
    right: 32px;
    bottom: 32px;
    width: 56px;
    height: 56px !important;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.35));
}

.jq-product {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 6px;
    padding: 6px 14px 6px 12px;
    border-radius: 999px;
    background: rgba(43, 181, 160, 0.18);
    border: 1px solid rgba(43, 181, 160, 0.5);
    color: #E9FBF7;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.jq-auth-card > .jq-lockup .jq-product {
    position: absolute;
    left: 32px;
    bottom: 36px;
    margin: 0;
}

.jq-product::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--jq-accent);
    box-shadow: 0 0 0 4px rgba(43, 181, 160, 0.25);
}

/* Non-card auth pages: compact lockup above the form on wash */
div.min-h-screen:has(.jq-lockup):not(:has(.jq-auth-card)) > a .jq-lockup,
div.min-h-screen:has(.jq-lockup):not(:has(.jq-auth-card)) > a > div {
    margin-top: 0 !important;
    margin-bottom: 8px !important;
}

div.min-h-screen:has(.jq-lockup):not(:has(.jq-auth-card)) > a .jq-logo {
    width: 56px;
    height: 56px !important;
    filter: drop-shadow(0 6px 18px rgba(11, 61, 46, 0.18));
}

div.min-h-screen:has(.jq-lockup):not(:has(.jq-auth-card)) > a .jq-product {
    background: rgba(11, 61, 46, 0.08);
    border-color: rgba(11, 61, 46, 0.18);
    color: var(--jq-primary);
}

div.min-h-screen:has(.jq-lockup):not(:has(.jq-auth-card)) > a .jq-product::before {
    background: var(--jq-accent);
}

/* Soft white form panel on non-split auth pages */
div.min-h-screen:has(.jq-lockup):not(:has(.jq-auth-card)) > div:not(.Toastify),
div.min-h-screen:has(.jq-lockup):not(:has(.jq-auth-card)) > form {
    width: min(440px, 100%);
    margin: 0 auto;
    padding: 28px 28px 32px !important;
    border-radius: 22px;
    background: #fff;
    border: 1px solid rgba(11, 61, 46, 0.08);
    box-shadow:
        0 2px 6px rgba(11, 61, 46, 0.06),
        0 24px 48px -12px rgba(11, 61, 46, 0.18);
}

/* ── Typography on auth ──────────────────────────────────────────────────── */
.jq-auth-card h1,
div.min-h-screen:has(.jq-lockup) h1 {
    background: none !important;
    -webkit-background-clip: unset !important;
    background-clip: unset !important;
    color: var(--jq-primary) !important;
    font-size: 1.85rem !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    letter-spacing: -0.03em !important;
    text-align: left !important;
    margin-bottom: 1.25rem !important;
}

.jq-auth-card label,
div.min-h-screen:has(.jq-lockup) label {
    color: var(--jq-primary) !important;
    font-weight: 700 !important;
}

/* ── Inputs ──────────────────────────────────────────────────────────────── */
.jq-auth-card .input,
.jq-auth-card input[type="email"],
.jq-auth-card input[type="password"],
.jq-auth-card input[type="text"],
div.min-h-screen:has(.jq-lockup) .input,
div.min-h-screen:has(.jq-lockup) input[type="email"],
div.min-h-screen:has(.jq-lockup) input[type="password"],
div.min-h-screen:has(.jq-lockup) input[type="text"] {
    color: var(--jq-text) !important;
    font-weight: 600 !important;
    font-family: "Nunito", "Inter", sans-serif !important;
    background: transparent !important;
}

.jq-auth-card [class*="border-mineshaft"][class*="bg-bunker"],
.jq-auth-card .inline-flex.items-center.border,
div.min-h-screen:has(.jq-lockup) [class*="border-mineshaft"][class*="bg-bunker"],
div.min-h-screen:has(.jq-lockup) .inline-flex.items-center.border {
    background: #FBFAF7 !important;
    border-color: var(--jq-border) !important;
    border-width: 1.5px !important;
    border-radius: var(--jq-radius) !important;
    color: var(--jq-text) !important;
    transition: background-color 0.2s, box-shadow 0.25s var(--jq-ease), border-color 0.2s;
}

.jq-auth-card .inline-flex.items-center.border:focus-within,
div.min-h-screen:has(.jq-lockup) .inline-flex.items-center.border:focus-within {
    background: #fff !important;
    border-color: var(--jq-accent) !important;
    box-shadow: var(--jq-ring);
}

.jq-auth-card input::placeholder,
div.min-h-screen:has(.jq-lockup) input::placeholder {
    color: var(--jq-muted) !important;
    opacity: 0.7;
    font-weight: 500;
}

/* ── Links ───────────────────────────────────────────────────────────────── */
.jq-auth-card a,
.jq-auth-card button[type="button"].text-sm,
div.min-h-screen:has(.jq-lockup) a,
div.min-h-screen:has(.jq-lockup) .text-bunker-300,
div.min-h-screen:has(.jq-lockup) .text-mineshaft-200 {
    color: var(--jq-accent-ink) !important;
    font-weight: 700;
}

.jq-auth-card a:hover,
div.min-h-screen:has(.jq-lockup) a:hover,
div.min-h-screen:has(.jq-lockup) .text-bunker-300:hover {
    color: var(--jq-primary) !important;
}

/* "or" divider */
.jq-auth-card .border-mineshaft-400\/60,
div.min-h-screen:has(.jq-lockup) .border-mineshaft-400\/60 {
    border-color: var(--jq-border) !important;
}

.jq-auth-card .text-xs.text-mineshaft-200,
div.min-h-screen:has(.jq-lockup) .text-xs.text-mineshaft-200 {
    color: var(--jq-muted) !important;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
/* Primary CTA (Continue with Email, etc.) */
.jq-auth-card button[type="submit"],
.jq-auth-card button[colorSchema="primary"],
.jq-auth-card .button[class*="bg-primary"],
div.min-h-screen:has(.jq-lockup) button[type="submit"],
div.min-h-screen:has(.jq-lockup) button.bg-primary,
div.min-h-screen:has(.jq-lockup) .bg-primary {
    min-height: 48px;
    border-radius: 14px !important;
    background: var(--jq-primary) !important;
    color: #fff !important;
    font-size: 1rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.01em;
    box-shadow: 0 10px 22px -10px rgba(11, 61, 46, 0.7) !important;
    transition: transform 0.22s var(--jq-ease), box-shadow 0.22s var(--jq-ease), background-color 0.2s;
}

.jq-auth-card button[type="submit"]:hover,
.jq-auth-card .bg-primary:hover,
div.min-h-screen:has(.jq-lockup) button[type="submit"]:hover,
div.min-h-screen:has(.jq-lockup) .bg-primary:hover {
    background: var(--jq-primary-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 16px 28px -10px rgba(11, 61, 46, 0.75), 0 0 0 4px rgba(43, 181, 160, 0.18) !important;
}

.jq-auth-card button[type="submit"]:focus-visible,
div.min-h-screen:has(.jq-lockup) button[type="submit"]:focus-visible {
    outline: 3px solid var(--jq-accent);
    outline-offset: 3px;
}

/* Secondary SSO / outline buttons (kept for real SSO pages if shown) */
.jq-auth-card button:not([type="submit"]):not(.bg-primary),
div.min-h-screen:has(.jq-lockup) form button:not([type="submit"]) {
    border-radius: 12px !important;
    font-weight: 700 !important;
    color: var(--jq-primary) !important;
    background: #fff !important;
    border: 1.5px solid rgba(11, 61, 46, 0.22) !important;
    box-shadow: none !important;
    transition: background-color 0.2s, border-color 0.2s, transform 0.2s var(--jq-ease);
}

.jq-auth-card button:not([type="submit"]):not(.bg-primary):hover,
div.min-h-screen:has(.jq-lockup) form button:not([type="submit"]):hover {
    background: var(--jq-primary-ultra) !important;
    border-color: var(--jq-primary) !important;
    transform: translateY(-1px);
}

/* ── Branded boot loader (wash + accent ring) ────────────────────────────── */
@keyframes jq-spin {
    to { transform: rotate(360deg); }
}

@keyframes jq-pulse-mark {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.04); opacity: 0.92; }
}

div.min-h-screen:has(.jq-lockup) img[src*="loading"],
div.min-h-screen:has(.jq-auth-card) img[src*="loading"] {
    animation: jq-pulse-mark 1.1s var(--jq-ease) infinite;
    filter: drop-shadow(0 12px 28px rgba(11, 61, 46, 0.22));
}

/* ── Motion ──────────────────────────────────────────────────────────────── */
@keyframes jq-rise {
    from { opacity: 0; transform: translateY(22px) scale(0.985); }
    to   { opacity: 1; transform: none; }
}

@keyframes jq-fade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .jq-auth-card,
    .jq-auth-card::after,
    .jq-auth-card > .jq-lockup,
    .jq-auth-card > .jq-auth-form,
    div.min-h-screen:has(.jq-lockup) img[src*="loading"] {
        animation: none !important;
    }

    .jq-auth-card button[type="submit"],
    div.min-h-screen:has(.jq-lockup) button[type="submit"] {
        transition: none;
        transform: none !important;
    }
}

/* ── Responsive: brand panel becomes a top band ──────────────────────────── */
@media (max-width: 820px) {
    div.min-h-screen:has(.jq-lockup),
    div.min-h-screen:has(.jq-auth-card) {
        padding: 12px !important;
        align-items: flex-start !important;
    }

    .jq-auth-card {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto;
        min-height: 0;
        border-radius: 22px !important;
    }

    .jq-auth-card::before {
        grid-column: 1;
        grid-row: 1;
        min-height: 200px;
        background:
            radial-gradient(18rem 12rem at 0% 0%, rgb(8 48 40 / 94%), transparent 68%),
            linear-gradient(
                180deg,
                rgba(11, 61, 46, 0.78) 0%,
                rgba(11, 61, 46, 0.62) 40%,
                rgba(8, 48, 40, 0.9) 100%
            ),
            var(--jq-landing) center / cover no-repeat,
            linear-gradient(160deg, #0F4D3B 0%, #0B3D2E 100%);
    }

    .jq-auth-card::after {
        display: none;
    }

    .jq-auth-card > .jq-lockup {
        grid-row: 1;
        min-height: 200px;
        padding: 0 !important;
    }

    .jq-auth-card > .jq-lockup .jq-logo {
        right: 20px;
        bottom: 20px;
        width: 44px;
        height: 44px !important;
    }

    .jq-auth-card > .jq-lockup .jq-product {
        left: 20px;
        bottom: 24px;
    }

    .jq-auth-card > .jq-auth-form {
        grid-column: 1;
        grid-row: 2;
        padding: 28px 22px 32px !important;
    }

    .jq-auth-card h1,
    div.min-h-screen:has(.jq-lockup) h1 {
        font-size: 1.45rem !important;
        text-align: center !important;
    }
}
