/* =============================================================
   elSAC.mx — Inicio
   Imagen fullscreen + panel glass overlay
   ============================================================= */

:root {
    --ink: #0f172a;
    --ink-muted: #475569;
    --ink-soft: #94a3b8;
    --border: #e2e8f0;
    --border-soft: #f1f5f9;

    /* Acento navy del logo elSAC */
    --accent: #1e3a5f;
    --accent-hover: #2a4d7d;

    --error: #b91c1c;
    --error-bg: #fef2f2;

    --panel-bg: rgba(255, 255, 255, 0.20);
    --panel-border: rgba(255, 255, 255, 0.5);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    --shadow-panel: 0 30px 60px -20px rgba(0, 0, 0, 0.45),
        0 12px 24px -12px rgba(0, 0, 0, 0.30);

    --duration: 320ms;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #0a0a0a;
    color: var(--ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow: hidden;
}

button {
    font-family: inherit;
}

/* ---------- Fondo fullscreen ---------- */

.bg {
    position: fixed;
    inset: 0;
    background-color: #0a0a0a;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transform: scale(1.06);
    opacity: 0;
    transition: opacity 1s var(--ease), transform 1.6s var(--ease);
    z-index: 0;
}

.bg.is-loaded {
    opacity: 1;
    transform: scale(1);
}

.bg-overlay {
    position: fixed;
    inset: 0;
    background:
        linear-gradient(110deg,
            rgba(0, 0, 0, 0.55) 0%,
            rgba(0, 0, 0, 0.30) 45%,
            rgba(0, 0, 0, 0.20) 65%,
            rgba(0, 0, 0, 0.55) 100%);
    z-index: 1;
}

/* ---------- Layout ---------- */

.inicio {
    position: relative;
    z-index: 2;
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-columns: 1.1fr 460px;
    gap: 40px;
    padding: 56px 64px;
}

/* ---------- Bienvenida (izquierda) ---------- */

.welcome {
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #fff;
    max-width: 640px;
}

.welcome__title {
    margin: 0 0 36px 0;
    font-family: 'Fraunces', 'Times New Roman', Georgia, serif;
    font-size: clamp(60px, 8.4vw, 124px);
    font-weight: 400;
    letter-spacing: -0.022em;
    line-height: 0.94;
    font-variation-settings: "opsz" 144, "SOFT" 40;
    text-shadow: 0 2px 36px rgba(0, 0, 0, 0.45);
}

.welcome__dot {
    color: oklch(0.74 0.12 245);
    margin-left: 0.02em;
}

.frase {
    margin: 0;
    max-width: 56ch;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 600ms var(--ease) 200ms, transform 600ms var(--ease) 200ms;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

.frase.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.frase__texto {
    margin: 0 0 18px 0;
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(20px, 1.85vw, 26px);
    line-height: 1.5;
    letter-spacing: -0.003em;
    font-variation-settings: "opsz" 36, "SOFT" 50;
    color: rgba(255, 255, 255, 0.94);
    text-indent: -0.36em;
    padding-left: 0.36em;
}

.frase__texto::before {
    content: '\201C';
    margin-right: 0.04em;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 500;
}

.frase__texto::after {
    content: '\201D';
    margin-left: 0.04em;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 500;
}

.frase__autor {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}

.frase__autor:not(:empty)::before {
    content: '— ';
    margin-right: 2px;
    letter-spacing: 0;
}

/* ---------- Panel de login (derecha) ---------- */

.form-panel {
    align-self: center;
    background: var(--panel-bg);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-panel);
    padding: 44px 40px 28px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    animation: panelIn 600ms var(--ease) both;
    color: #fff;
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-panel__head {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.logo {
    width: 180px;
    height: auto;
    align-self: flex-start;
    filter: brightness(0) invert(1) drop-shadow(0 2px 12px rgba(0, 0, 0, 0.4));
}

.form-panel__subtitle {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    transition: opacity 200ms var(--ease);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

.form-panel__foot {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.form-panel__foot .dot {
    margin: 0 6px;
}

/* ---------- Steps ---------- */

.form {
    position: relative;
    display: grid;
}

.step {
    grid-area: 1 / 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    opacity: 0;
    transform: translateX(16px);
    pointer-events: none;
    transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease);
}

.step--active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.step--exit-left {
    opacity: 0;
    transform: translateX(-16px);
}

/* ---------- Field ---------- */

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

.field__label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.field__input {
    width: 100%;
    padding: 13px 14px;
    font-size: 15px;
    font-family: inherit;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease), background 160ms var(--ease);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.field__input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.field__input:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.18);
}

.field__input:focus {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.20);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

.field__pwd {
    position: relative;
    display: flex;
}

.field__pwd .field__input {
    padding-right: 44px;
}

.field__toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    border-radius: 8px;
    transition: color 160ms var(--ease), background 160ms var(--ease);
}

.field__toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

/* ---------- Botones ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 18px;
    font-size: 14px;
    font-weight: 600;
    border: 0;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 160ms var(--ease), transform 160ms var(--ease), opacity 160ms var(--ease), box-shadow 160ms var(--ease);
    position: relative;
    margin-top: 4px;
}

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

.btn--primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px -4px rgba(30, 58, 95, 0.4);
}

.btn--primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 6px 16px -4px rgba(30, 58, 95, 0.5);
}

.btn[disabled],
.btn.is-loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn__spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

.btn.is-loading .btn__label {
    opacity: 0.6;
}

.btn.is-loading .btn__spinner {
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- Volver (paso 2) ---------- */

.back {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 8px;
    margin-bottom: 4px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    cursor: pointer;
    transition: background 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease);
    max-width: 100%;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.back>span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 240px;
}

.back:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.18);
}

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

.form__error {
    margin: 4px 0 0 0;
    padding: 0 12px;
    font-size: 13px;
    color: var(--error);
    background: var(--error-bg);
    border-radius: var(--radius-sm);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 200ms var(--ease), max-height 200ms var(--ease), padding 200ms var(--ease);
}

.form__error.is-visible {
    opacity: 1;
    max-height: 80px;
    padding: 10px 12px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
    .inicio {
        grid-template-columns: 1fr 420px;
        gap: 24px;
        padding: 40px;
    }
}

@media (max-width: 880px) {

    html,
    body {
        overflow: auto;
    }

    .inicio {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
        padding: 28px;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .welcome {
        text-align: center;
        align-items: center;
        max-width: none;
    }

    .welcome__title {
        margin-bottom: 20px;
    }

    .frase__texto {
        margin-left: auto;
        margin-right: auto;
    }

    .form-panel {
        width: 100%;
        max-width: 460px;
        margin: 0 auto;
        padding: 32px 28px 24px;
    }
}

@media (max-width: 480px) {
    .inicio {
        padding: 20px;
    }

    .welcome__title {
        font-size: 56px;
        letter-spacing: -0.02em;
        font-variation-settings: "opsz" 96, "SOFT" 50;
    }

    .frase__texto {
        font-size: 18px;
    }

    .form-panel {
        padding: 28px 22px 20px;
    }

    .logo {
        width: 150px;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}