/* ============================================================
   Naura ALGO — Sign in
   Palette: Nord (https://www.nordtheme.com/)
   Type:    JetBrains Mono (self-hosted)

   Tokens are declared here rather than imported so the login page is a single
   stylesheet with no extra round-trip — it is the first thing anyone loads.
   They match Naura X's theme.css exactly; keep the two in step.
   ============================================================ */

@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 300 700;   /* variable-weight range */
    font-display: swap;
    src: url("assets/fonts/jetbrains-mono-latin.woff2") format("woff2");
}

:root {
    /* Nord — Polar Night */
    --nord0: #2e3440;
    --nord1: #3b4252;
    --nord2: #434c5e;
    --nord3: #4c566a;
    /* Nord — Snow Storm */
    --nord4: #d8dee9;
    --nord5: #e5e9f0;
    --nord6: #eceff4;
    /* Nord — Frost */
    --nord7: #8fbcbb;
    --nord8: #88c0d0;
    --nord9: #81a1c1;
    --nord10: #5e81ac;
    /* Nord — Aurora */
    --nord11: #bf616a;
    --nord13: #ebcb8b;
    --nord14: #a3be8c;

    --radius: 14px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --font: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- Dark (default) ---------- */
:root,
[data-theme="dark"] {
    color-scheme: dark;
    --bg: var(--nord0);
    --panel: rgba(46, 52, 64, 0.55);
    --panel-border: rgba(216, 222, 233, 0.10);
    --field-bg: rgba(59, 66, 82, 0.75);
    --field-border: rgba(216, 222, 233, 0.14);
    --text: var(--nord6);
    --text-dim: rgba(216, 222, 233, 0.62);
    --accent: var(--nord8);
    --accent-strong: var(--nord9);
    --accent-ink: var(--nord0);
    --ok: var(--nord14);
    --danger: var(--nord11);
    --warn: var(--nord13);
    --scrim-a: rgba(46, 52, 64, 0.55);
    --scrim-b: rgba(46, 52, 64, 0.88);
    --backdrop-filter: saturate(0.85) brightness(0.72);
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

/* ---------- Light ---------- */
[data-theme="light"] {
    color-scheme: light;
    --bg: var(--nord6);
    --panel: rgba(236, 239, 244, 0.72);
    --panel-border: rgba(46, 52, 64, 0.10);
    --field-bg: rgba(255, 255, 255, 0.85);
    --field-border: rgba(46, 52, 64, 0.16);
    --text: var(--nord0);
    --text-dim: rgba(46, 52, 64, 0.60);
    --accent: var(--nord10);
    --accent-strong: var(--nord9);
    --accent-ink: var(--nord6);
    --ok: #4c8c3f;
    --danger: #b23b45;
    --warn: #8a5d00;
    --scrim-a: rgba(229, 233, 240, 0.45);
    --scrim-b: rgba(216, 222, 233, 0.78);
    --backdrop-filter: saturate(1.05) brightness(1.05);
    --shadow: 0 24px 70px rgba(46, 52, 64, 0.28);
}

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

html, body { height: 100%; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    position: relative;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.backdrop {
    position: fixed;
    inset: 0;
    background: url("assets/background.jpg") center / cover no-repeat;
    filter: var(--backdrop-filter);
    transition: filter 0.5s var(--ease);
    z-index: -2;
}

.scrim {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(120% 80% at 50% 0%, transparent 0%, var(--scrim-a) 55%, var(--scrim-b) 100%),
        linear-gradient(180deg, transparent 40%, var(--scrim-b) 100%);
    transition: background 0.5s var(--ease);
    z-index: -1;
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--panel-border);
    background: var(--panel);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: var(--text);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 0.25s var(--ease), border-color 0.25s var(--ease);
    z-index: 10;
}
.theme-toggle:hover { transform: translateY(-1px) rotate(-8deg); border-color: var(--accent); }
.theme-toggle__icon { grid-area: 1 / 1; transition: opacity 0.3s var(--ease), transform 0.3s var(--ease); }
[data-theme="dark"]  .theme-toggle__icon[data-icon="light"] { opacity: 0; transform: scale(0.4) rotate(90deg); }
[data-theme="light"] .theme-toggle__icon[data-icon="dark"]  { opacity: 0; transform: scale(0.4) rotate(-90deg); }

/* ---------- Card ---------- */
.login {
    width: min(520px, 100%);
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: calc(var(--radius) + 6px);
    backdrop-filter: blur(22px) saturate(1.1);
    -webkit-backdrop-filter: blur(22px) saturate(1.1);
    box-shadow: var(--shadow);
    padding: 3rem 2.5rem 2.25rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    animation: rise 0.7s var(--ease) both;
}
@keyframes rise {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.view { display: flex; flex-direction: column; gap: 1.1rem; }
.view[hidden] { display: none; }

.brand { text-align: center; }
.brand__mark {
    font-size: clamp(2.2rem, 7vw, 3.1rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}
.brand__algo {
    color: var(--accent);
    margin-left: 0.18em;
    text-shadow: 0 0 26px color-mix(in srgb, var(--accent) 55%, transparent);
}
.brand__tagline {
    margin-top: 0.85rem;
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--text-dim);
}

/* ---------- Access row: input + Go ---------- */
.access {
    display: flex;
    gap: 0.6rem;
    align-items: stretch;
}

.access__field {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 0.9rem;
    min-width: 0;
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: var(--radius);
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.access__field:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.access__field.is-error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent);
}
.access__glyph { color: var(--text-dim); flex: none; }

.access__input {
    flex: 1;
    min-width: 0;
    height: 52px;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}
.access__input::placeholder { color: var(--text-dim); letter-spacing: 0.02em; }
.access__input:focus { outline: none; }

.access__reveal {
    border: none;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0.2rem;
    display: grid;
    place-items: center;
    line-height: 0;
    opacity: 0.75;
    transition: opacity 0.2s var(--ease);
}
.access__reveal:hover { opacity: 1; }

.access__go {
    flex: none;
    padding: 0 1.7rem;
    border: none;
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    color: var(--accent-ink);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    display: grid;
    place-items: center;
    text-decoration: none;
    transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), filter 0.18s var(--ease);
    box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 35%, transparent);
}
.access__go:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 12px 28px color-mix(in srgb, var(--accent) 45%, transparent); }
.access__go:active { transform: translateY(0); }
.access__go:disabled,
.access__go[aria-disabled="true"] { opacity: 0.55; cursor: progress; transform: none; box-shadow: none; }

/* ---------- Keep me signed in ---------- */
.remember {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--text-dim);
}
.remember__box {
    appearance: none;
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    flex: none;
    border: 1px solid var(--field-border);
    border-radius: 4px;
    background: var(--field-bg);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.remember__box:checked { background: var(--accent); border-color: var(--accent); }
.remember__box:checked::after {
    content: "";
    width: 7px;
    height: 4px;
    border-left: 2px solid var(--accent-ink);
    border-bottom: 2px solid var(--accent-ink);
    transform: rotate(-45deg) translate(0.5px, -1px);
}
.remember__box:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Hint ---------- */
.hint {
    min-height: 1.1em;
    text-align: center;
    font-size: 0.72rem;
    line-height: 1.6;
    letter-spacing: 0.04em;
    color: var(--text-dim);
    transition: color 0.25s var(--ease);
    text-wrap: pretty;
}
.hint.is-error { color: var(--danger); }
.hint.is-ok    { color: var(--ok); }
.hint.is-warn  { color: var(--warn); }

/* ---------- Signed-in state ---------- */
.session {
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    text-align: center;
}
.session__who {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}
.session__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 10px var(--ok);
    animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.session__label { color: var(--text-dim); text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.14em; }
.session__name { font-size: 1rem; font-weight: 700; color: var(--accent); }
.session__note {
    margin-top: 0.6rem;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    color: var(--text-dim);
}
.session__actions { display: flex; gap: 0.6rem; align-items: stretch; }
.session__go { flex: 1; height: 52px; }

.ghost {
    flex: none;
    padding: 0 1.2rem;
    height: 52px;
    border: 1px solid var(--field-border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-dim);
    font-family: var(--font);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.ghost:hover { color: var(--text); border-color: var(--accent); }

/* ---------- Footer ---------- */
.footer {
    position: fixed;
    bottom: 1.35rem;
    left: 0;
    right: 0;
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    align-items: center;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.footer__dot { opacity: 0.5; }
.footer .is-insecure { color: var(--warn); font-weight: 600; }

@media (max-width: 480px) {
    .login { padding: 2.25rem 1.5rem 1.75rem; }
    .access { flex-direction: column; }
    .access__go { height: 50px; }
    .session__actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
