/* RanToRam 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 rantoram-atmos.css
   (the pond backdrop, lotuses, chrome sweep) instead of the full panel
   theme. */

:root {
    --mn-font-body: 'Onest', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mn-font-display: 'Unbounded', 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mn-ink: 236, 240, 246;
    --mn-ink-muted: 160, 168, 182;
    /* Dark ink for anything sitting on a silver fill (buttons, avatars). */
    --mn-ink-on-primary: 10, 12, 16;
    --mn-surface: 17, 20, 26;
    --mn-hairline: rgba(var(--mn-primary-2), 0.14);
}

* { box-sizing: border-box; }

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

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

::selection { background: rgba(var(--mn-accent), 0.55); color: #fff; }

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

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

.mn-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(--mn-hairline);
    background: linear-gradient(170deg, rgba(22, 25, 32, 0.8), rgba(var(--mn-surface), 0.9) 55%, rgba(6, 7, 10, 0.94));
    box-shadow:
        inset 0 1px 0 rgba(var(--mn-primary-2), 0.16),
        0 30px 70px -26px rgba(0, 0, 0, 0.85),
        0 0 60px -30px rgba(var(--mn-primary), 0.28);
    animation: mn-rise 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

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

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

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

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

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

.mn-brand .mn-mark img {
    display: block;
    height: 4.75rem;
    width: auto;
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 22px rgba(var(--mn-chrome-mid), 0.22));
}

.mn-name {
    font-family: var(--mn-font-display);
    font-weight: 600;
    font-size: 1.3rem;
    letter-spacing: 0.04em;
    line-height: 1;
    background: linear-gradient(100deg, rgb(var(--mn-chrome-hi)) 8%, rgb(var(--mn-chrome)) 30%, rgb(var(--mn-chrome-lo)) 56%, rgb(var(--mn-chrome)) 78%, rgb(var(--mn-chrome-hi)) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mn-name b,
.mn-hero-name b {
    font-weight: 300;
    margin-inline: 0.04em;
    background: linear-gradient(176deg, rgb(var(--mn-chrome-mid)), rgb(var(--mn-chrome-lo)));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

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

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

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

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

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

.mn-input {
    width: 100%;
    padding: 0.85rem 1rem;
    font: inherit;
    font-size: 0.9375rem;
    color: #fff;
    border-radius: 0.875rem;
    border: 1px solid var(--mn-hairline);
    background: rgba(6, 7, 10, 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;
}

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

.mn-input:focus {
    outline: none;
    border-color: rgb(var(--mn-primary));
    background: rgba(var(--mn-primary), 0.06);
    box-shadow: 0 0 0 4px rgba(var(--mn-primary), 0.12), 0 0 26px -10px rgba(var(--mn-primary-2), 0.45);
}

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

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

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

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

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

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

.mn-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 ---------- */

.mn-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: rgb(var(--mn-ink-on-primary));
    cursor: pointer;
    /* Brushed silver: the face of the mark, lit from above. */
    background: linear-gradient(180deg, rgb(var(--mn-chrome-hi)) 0%, rgb(var(--mn-chrome)) 46%, rgb(var(--mn-chrome-mid)) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(var(--mn-chrome-lo), 0.5), 0 12px 28px -14px rgba(var(--mn-primary), 0.55);
    transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 200ms ease, filter 200ms ease;
}

.mn-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.07);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 -1px 0 rgba(var(--mn-chrome-lo), 0.5), 0 16px 34px -14px rgba(var(--mn-primary), 0.6), 0 0 34px -14px rgba(var(--mn-primary-2), 0.5);
}

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

.mn-btn:focus-visible {
    outline: 2px solid rgb(var(--mn-primary-2));
    outline-offset: 3px;
}

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

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

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

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

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

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

.mn-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(--mn-hairline);
    background: rgba(6, 7, 10, 0.55);
}

.mn-avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    font-family: var(--mn-font-display);
    font-weight: 600;
    font-size: 0.9rem;
    color: rgb(var(--mn-ink-on-primary));
    background: linear-gradient(180deg, rgb(var(--mn-chrome-hi)), rgb(var(--mn-chrome-mid)));
    box-shadow: 0 0 0 3px rgba(var(--mn-primary), 0.14);
}

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

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

.mn-code {
    display: block;
    margin: -0.25rem 0 0.5rem;
    font-family: var(--mn-font-display);
    font-weight: 300;
    font-size: 4.5rem;
    line-height: 1;
    letter-spacing: 0.04em;
    background: linear-gradient(176deg, rgb(var(--mn-chrome-hi)) 0%, rgb(var(--mn-chrome)) 26%, rgb(var(--mn-chrome-lo)) 52%, rgb(var(--mn-chrome)) 72%, rgb(var(--mn-chrome-hi)) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 8px 26px rgba(var(--mn-primary), 0.22));
}

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

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

.mn-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(4, 5, 7, 0.8), rgba(4, 5, 7, 0.45));
    border-inline-end: 1px solid rgba(var(--mn-primary-2), 0.08);
}

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

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

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

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

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

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

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

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

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

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

/* The flower the mark floats on: the rosette from the room's corners, large
   and faint, turning very slowly behind the ripples. */
.mn-hero-lotus {
    position: absolute;
    inset: -34%;
    background: var(--mn-lotus-top) center / contain no-repeat;
    opacity: 0.2;
    animation: mn-turn 240s linear infinite;
}

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

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

.mn-hero .mn-mark img {
    display: block;
    width: 14rem;
    height: auto;
    filter: drop-shadow(0 22px 40px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 30px rgba(var(--mn-chrome-mid), 0.25));
}

.mn-hero-name {
    display: block;
    font-family: var(--mn-font-display);
    font-weight: 600;
    font-size: clamp(2.5rem, 4.5vw, 3.5rem);
    letter-spacing: 0.03em;
    line-height: 1;
    background: linear-gradient(100deg, rgb(var(--mn-chrome-hi)) 8%, rgb(var(--mn-chrome)) 30%, rgb(var(--mn-chrome-lo)) 56%, rgb(var(--mn-chrome)) 78%, rgb(var(--mn-chrome-hi)) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

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