/* =========================================
   DigitalFakt ID — Stylesheet
   Self-hosted fonts, dark design system, no build step.
   ========================================= */

/* ===== Font faces ===== */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin.260c81a4759b.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
        U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin-ext.1ad231aac0a8.woff2") format('woff2');
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
        U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Space Grotesk';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url("../fonts/space-grotesk-latin.87c506d88b9f.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
        U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Space Grotesk';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url("../fonts/space-grotesk-latin-ext.0bb2ef2eda4e.woff2") format('woff2');
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
        U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ===== Tokens ===== */
:root {
    --bg: #0a0a0c;
    --bg-soft: #111114;
    --bg-elev: #16161b;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-strong: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);

    --text: #f4f4f5;
    --text-muted: #a1a1a8;
    --text-dim: #6b6b73;

    --accent: #6366f1;
    --accent-2: #06b6d4;
    --accent-3: #f0abfc;
    --gradient: linear-gradient(135deg, #6366f1 0%, #06b6d4 50%, #f0abfc 100%);
    --gradient-soft: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(6, 182, 212, 0.12) 100%);

    --shadow-glow: 0 0 80px rgba(99, 102, 241, 0.25);

    --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;

    --radius-sm: 8px;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);

    --error: #fca5a5;
    --error-bg: rgba(248, 113, 113, 0.12);
    --error-border: rgba(248, 113, 113, 0.4);
}

/* ===== Reset / base ===== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
    color-scheme: dark;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: var(--font-display);
    line-height: 1.2;
    font-weight: 500;
}

a {
    color: var(--accent-2);
    text-decoration: none;
}
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

ul { list-style: none; }

code, pre, .mono { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; }

:focus {
    outline: none;
}
:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-2);
    border-radius: var(--radius-sm);
}

/* ===== Layout ===== */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--bg-elev);
    color: var(--text);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    z-index: 100;
}
.skip-link:focus {
    left: 12px;
    top: 12px;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image:
        radial-gradient(60% 50% at 50% -10%, rgba(99, 102, 241, 0.18), transparent 70%),
        radial-gradient(40% 40% at 100% 10%, rgba(6, 182, 212, 0.1), transparent 70%);
    background-repeat: no-repeat;
}

.auth-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 24px;
}

.auth-topbar {
    display: flex;
    justify-content: flex-end;
    padding: 16px 16px 0;
}

.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.app-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.app-main {
    flex: 1;
    width: min(100% - 32px, 960px);
    margin-inline: auto;
    padding: 32px 0;
}

/* ===== Components ===== */

/* Brand */
.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--text);
}
.logo-img {
    width: auto;
    height: 38px;
    object-fit: contain;
}
.logo-text { font-weight: 300; }
.logo-text strong { font-weight: 700; }
.logo-suffix {
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 2px;
}

/* Card */
.card {
    width: 100%;
    max-width: 420px;
    margin-inline: auto;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    box-shadow: var(--shadow-glow);
}
.card-wide { max-width: 560px; }

.card-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    text-align: center;
}

.card-title {
    font-size: 1.3rem;
    font-weight: 600;
}

.card-lead {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

/* Form */
.field {
    margin-bottom: 18px;
}
.field label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
}
.field input,
.field select {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s var(--ease);
}
.field input::placeholder { color: var(--text-dim); }
.field input:hover { border-color: var(--text-dim); }
.field-hint {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--text-dim);
}
.field-error {
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--error);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 12px 24px;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.2s var(--ease), background 0.2s var(--ease),
        border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
    white-space: nowrap;
}
.btn-block { width: 100%; }

.btn-primary {
    background: var(--text);
    color: var(--bg);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(99, 102, 241, 0.35); }

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-strong); border-color: var(--text-muted); }

.btn-small {
    min-height: 36px;
    padding: 8px 16px;
    font-size: 0.85rem;
}

.text-link {
    color: var(--accent-2);
    font-size: 0.9rem;
}

/* Alert */
.alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    margin-bottom: 18px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}
.alert-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error);
}
.alert-marker {
    font-weight: 700;
    flex-shrink: 0;
}
.alert ul { padding-left: 0; }
.alert li + li { margin-top: 4px; }

/* QR block */
.qr-block {
    background: #ffffff;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}
.qr-block svg {
    width: 100%;
    max-width: 220px;
    height: auto;
    display: block;
}

/* Secret key */
.secret-key {
    display: block;
    word-break: break-all;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: var(--text);
    user-select: all;
}

/* Secondary action below a card form (e.g. cancel a pending sign-in) */
.card-cancel {
    margin-top: 8px;
    text-align: center;
}
.link-button {
    min-height: 44px;
    padding: 10px 16px;
    background: none;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}
.link-button:hover { color: var(--text); }
.link-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-2);
}

/* Steps */
.steps {
    list-style: none;
    counter-reset: step;
    margin-bottom: 20px;
    padding-left: 0;
}
.steps li {
    counter-increment: step;
    position: relative;
    padding-left: 36px;
    margin-bottom: 14px;
    color: var(--text-muted);
    font-size: 0.92rem;
}
.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface-strong);
    border: 1px solid var(--border-strong);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Recovery codes */
.recovery-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 20px;
}
@media (min-width: 420px) {
    .recovery-list { grid-template-columns: 1fr 1fr; }
}
.recovery-list li {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 0.92rem;
    text-align: center;
    user-select: all;
}

.warning-box {
    background: var(--gradient-soft);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Language switcher */
.lang-switch {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
}
.lang-switch form { display: inline-flex; }
.lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 32px;
    padding: 4px 10px;
    border-radius: 999px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.lang-btn:hover { color: var(--text); }
.lang-btn[aria-current="true"] {
    background: var(--surface-strong);
    color: var(--text);
    box-shadow: 0 0 0 1px var(--border-strong);
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 20px 16px 28px;
    font-size: 0.82rem;
    color: var(--text-dim);
}
.site-footer a {
    color: var(--text-dim);
    margin: 0 8px;
}
.site-footer a:hover { color: var(--text-muted); }

/* Top bar (logged-in pages) */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.topbar-end {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.topbar-email {
    color: var(--text-muted);
    font-size: 0.9rem;
    word-break: break-all;
}

/* Messages */
.messages {
    width: min(100% - 32px, 420px);
    margin: 0 auto 16px;
}
.messages li {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Password rules arrive as a list inside the hint. */
.field-hint ul {
    margin: 6px 0 0;
    padding-left: 18px;
}
.field-hint li { margin-bottom: 2px; }
