/* WHALE standalone pages - sign-in, 2FA, account redirect, impersonation
   hand-off and the 403/404 error pages. These render outside any Filament
   panel, so they get their own small stylesheet on top of whale-ocean.css
   (backdrop, spout, waves) instead of the full panel theme. */

:root {
    --wh-font-body: 'Onest', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --wh-font-display: 'Unbounded', 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --wh-ink: 236, 244, 252;
    --wh-ink-muted: 158, 178, 204;
    --wh-surface: 10, 24, 48;
    --wh-hairline: rgba(var(--gp-primary-2), 0.14);
}

* { box-sizing: border-box; }

html {
    height: 100%;
    background-color: rgb(var(--gp-navy-950));
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--wh-font-body);
    color: rgb(var(--wh-ink));
    background: transparent;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

::selection { background: rgba(var(--gp-primary), 0.45); color: #fff; }

/* ---------- Centered card pages ---------- */

.wh-center {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem 7rem;
}

.wh-card {
    position: relative;
    width: 100%;
    max-width: 25rem;
    padding: 2.25rem 2rem 2.75rem;
    border-radius: 1.75rem;
    overflow: hidden;
    isolation: isolate;
    text-align: center;
    border: 1px solid var(--wh-hairline);
    background: linear-gradient(170deg, rgba(18, 42, 82, 0.78), rgba(var(--wh-surface), 0.9) 55%, rgba(4, 12, 28, 0.94));
    box-shadow:
        inset 0 1px 0 rgba(var(--gp-primary-2), 0.16),
        0 30px 70px -26px rgba(1, 6, 18, 0.85),
        0 0 60px -30px rgba(var(--gp-primary), 0.55);
    animation: wh-rise 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Light from the surface across the top edge... */
.wh-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    z-index: -1;
    background: linear-gradient(90deg, transparent, rgba(var(--gp-primary), 0.6) 25%, rgba(var(--gp-accent-green-bright), 0.9) 50%, rgba(var(--gp-primary), 0.6) 75%, transparent);
}

/* ...and a slow swell along the bottom one. */
.wh-card::after {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 3.25rem;
    z-index: -1;
    pointer-events: none;
    background:
        var(--wh-wave-fill) repeat-x 0 100% / 400px 70%,
        var(--wh-wave-fill-deep) repeat-x 140px 100% / 400px 100%;
    animation: wh-card-swell 16s linear infinite;
}

@keyframes wh-card-swell {
    from { background-position: 0 100%, 140px 100%; }
    to { background-position: -400px 100%, 540px 100%; }
}

@keyframes wh-rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Brand ---------- */

.wh-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.wh-brand .wh-mark {
    --h: 1.7rem;
    margin-top: 1.25rem;
}

.wh-brand .wh-mark img {
    display: block;
    height: 4.75rem;
    width: auto;
    filter: drop-shadow(0 10px 24px rgba(var(--gp-primary), 0.5));
}

.wh-name {
    font-family: var(--wh-font-display);
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: 0.22em;
    line-height: 1;
    padding-inline-start: 0.22em;
    background: linear-gradient(100deg, rgb(var(--wh-foam)) 20%, rgb(var(--gp-primary-2)) 70%, rgb(var(--gp-primary)) 115%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.wh-title {
    margin: 0 0 0.5rem;
    font-family: var(--wh-font-display);
    font-weight: 400;
    font-size: 1.1875rem;
    line-height: 1.35;
}

.wh-hint {
    margin: 0 0 1.75rem;
    font-size: 0.9rem;
    line-height: 1.55;
    color: rgb(var(--wh-ink-muted));
}

/* ---------- Forms ---------- */

.wh-field { margin-bottom: 1.125rem; text-align: start; }

.wh-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgb(var(--wh-ink-muted));
}

.wh-input-wrap { position: relative; }

.wh-input {
    width: 100%;
    padding: 0.85rem 1rem;
    font: inherit;
    font-size: 0.9375rem;
    color: #fff;
    border-radius: 0.875rem;
    border: 1px solid var(--wh-hairline);
    background: rgba(4, 14, 32, 0.6);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.wh-input::placeholder { color: rgba(var(--wh-ink-muted), 0.6); }

.wh-input:focus {
    outline: none;
    border-color: rgb(var(--gp-primary));
    background: rgba(var(--gp-primary), 0.08);
    box-shadow: 0 0 0 4px rgba(var(--gp-primary), 0.18), 0 0 26px -10px rgba(var(--gp-primary-2), 0.7);
}

.wh-input--code {
    text-align: center;
    font-family: var(--wh-font-display);
    font-size: 1.375rem;
    letter-spacing: 0.35em;
    padding-inline-start: calc(1rem + 0.35em);
}

.wh-input--with-toggle { padding-inline-end: 2.875rem; }

.wh-eye {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    display: flex;
    padding: 0.375rem;
    border: 0;
    background: none;
    color: rgb(var(--wh-ink-muted));
    cursor: pointer;
}

.wh-eye:hover { color: #fff; }
.wh-eye svg { width: 1.25rem; height: 1.25rem; }
.wh-eye .icon-hide { display: none; }
.wh-eye[data-visible="true"] .icon-show { display: none; }
.wh-eye[data-visible="true"] .icon-hide { display: block; }

.wh-check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0.25rem 0 1.75rem;
    font-size: 0.875rem;
    color: rgb(var(--wh-ink-muted));
    cursor: pointer;
    user-select: none;
}

.wh-check input {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: rgb(var(--gp-primary));
    cursor: pointer;
}

.wh-error {
    margin-bottom: 1.125rem;
    padding: 0.7rem 0.9rem;
    border-radius: 0.875rem;
    font-size: 0.8125rem;
    text-align: start;
    color: rgb(252, 165, 165);
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.28);
}

/* ---------- Buttons ---------- */

.wh-btn {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.9rem 1rem;
    border: 0;
    border-radius: 0.875rem;
    font: inherit;
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, rgb(var(--gp-accent-green-bright)) -45%, rgb(var(--gp-primary)) 40%, rgb(var(--gp-accent-green)) 110%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 12px 28px -12px rgba(var(--gp-primary), 0.75);
    transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 200ms ease, filter 200ms ease;
}

.wh-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.07);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 16px 34px -12px rgba(var(--gp-primary), 0.85), 0 0 34px -12px rgba(var(--gp-primary-2), 0.7);
}

.wh-btn:active { transform: translateY(0); }

.wh-btn:focus-visible {
    outline: 2px solid rgb(var(--gp-accent-green-bright));
    outline-offset: 3px;
}

.wh-btn + .wh-btn,
.wh-btn + form,
form + .wh-btn { margin-top: 0.75rem; }

.wh-btn--ghost {
    color: rgb(var(--wh-ink));
    background: rgba(var(--gp-primary-2), 0.04);
    box-shadow: inset 0 0 0 1px rgba(var(--gp-primary-2), 0.22);
}

.wh-btn--ghost:hover {
    background: rgba(var(--gp-primary-2), 0.1);
    box-shadow: inset 0 0 0 1px rgba(var(--gp-accent-green-bright), 0.5);
    filter: none;
}

.wh-link {
    display: inline-block;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: rgb(var(--wh-ink-muted));
    text-decoration: none;
}

.wh-link:hover { color: rgb(var(--gp-primary-2)); }

/* ---------- Account (already signed in) ---------- */

.wh-account {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    padding: 0.9rem 1rem;
    text-align: start;
    border-radius: 1.125rem;
    border: 1px solid var(--wh-hairline);
    background: rgba(4, 14, 32, 0.55);
}

.wh-avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    font-family: var(--wh-font-display);
    font-weight: 600;
    font-size: 0.9rem;
    color: #fff;
    background: linear-gradient(150deg, rgb(var(--gp-accent-green-bright)) -40%, rgb(var(--gp-primary)) 50%, rgb(var(--gp-accent-green)));
    box-shadow: 0 0 0 3px rgba(var(--gp-primary), 0.18);
}

.wh-account-email { font-size: 0.9375rem; font-weight: 600; word-break: break-all; }
.wh-account-role { margin-top: 0.15rem; font-size: 0.8125rem; color: rgb(var(--wh-ink-muted)); }

/* ---------- Error pages ---------- */

.wh-code {
    display: block;
    margin: -0.25rem 0 0.5rem;
    font-family: var(--wh-font-display);
    font-weight: 300;
    font-size: 4.5rem;
    line-height: 1;
    letter-spacing: 0.04em;
    background: linear-gradient(180deg, rgb(var(--wh-foam)) 10%, rgb(var(--gp-primary-2)) 50%, rgb(var(--gp-primary)) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 8px 26px rgba(var(--gp-primary), 0.45));
}

/* ---------- Sign-in: split layout ---------- */

.wh-login {
    min-height: 100vh;
    display: flex;
}

.wh-login-form {
    flex: 1 1 46%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem 6rem;
    position: relative;
    background: linear-gradient(90deg, rgba(3, 8, 20, 0.78), rgba(3, 8, 20, 0.45));
    border-inline-end: 1px solid rgba(var(--gp-primary-2), 0.08);
}

.wh-login-form-inner {
    width: 100%;
    max-width: 23rem;
    animation: wh-rise 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

.wh-login-form .wh-brand--inline {
    display: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.75rem;
}

.wh-login-form .wh-brand--inline .wh-mark { --h: 1.1rem; margin-top: 0.75rem; }
.wh-login-form .wh-brand--inline .wh-mark img { height: 3rem; }

.wh-login-heading {
    margin: 0 0 0.6rem;
    font-family: var(--wh-font-display);
    font-weight: 400;
    font-size: 1.75rem;
    line-height: 1.2;
}

.wh-login-sea {
    flex: 1 1 54%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow: hidden;
}

.wh-hero {
    position: relative;
    text-align: center;
    animation: wh-rise 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.wh-hero-stage {
    position: relative;
    width: 17rem;
    height: 17rem;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sonar: rings rolling out from behind the whale. */
.wh-sonar {
    position: absolute;
    inset: 8%;
    border-radius: 50%;
    border: 1px solid rgba(var(--gp-primary-2), 0.35);
    opacity: 0;
    animation: wh-sonar-ring 6s cubic-bezier(0.2, 0.6, 0.35, 1) infinite;
}

.wh-sonar:nth-child(2) { animation-delay: 2s; }
.wh-sonar:nth-child(3) { animation-delay: 4s; }

@keyframes wh-sonar-ring {
    0% { transform: scale(0.55); opacity: 0; }
    15% { opacity: 0.8; }
    100% { transform: scale(1.55); opacity: 0; }
}

.wh-hero-glow {
    position: absolute;
    inset: 5%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--gp-primary), 0.42), rgba(var(--gp-primary), 0.08) 55%, transparent 70%);
    filter: blur(8px);
}

.wh-hero .wh-mark {
    --h: 3.6rem;
    margin-top: 2rem;
}

.wh-hero .wh-mark img {
    display: block;
    width: 14rem;
    height: auto;
    filter: drop-shadow(0 22px 40px rgba(1, 6, 18, 0.7)) drop-shadow(0 0 30px rgba(var(--gp-primary), 0.35));
}

.wh-hero-name {
    display: block;
    font-family: var(--wh-font-display);
    font-weight: 600;
    font-size: clamp(2.5rem, 4.5vw, 3.5rem);
    letter-spacing: 0.26em;
    padding-inline-start: 0.26em;
    line-height: 1;
    background: linear-gradient(100deg, rgb(var(--wh-foam)) 15%, rgb(var(--gp-primary-2)) 60%, rgb(var(--gp-primary)) 110%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@media (max-width: 880px) {
    .wh-login-sea { display: none; }
    .wh-login-form { flex-basis: 100%; background: rgba(3, 8, 20, 0.35); border: 0; }
    .wh-login-form .wh-brand--inline { display: flex; margin-bottom: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
    .wh-card,
    .wh-card::after,
    .wh-login-form-inner,
    .wh-hero,
    .wh-sonar {
        animation: none !important;
    }
}
