/* Fonts are loaded via <link> tags in each page <head>. */

/* ============ THEME TOKENS ============ */
:root {
    --bg:        oklch(0.97 0.012 75);
    --surface:   oklch(0.995 0.006 75);
    --paper:     oklch(0.985 0.008 75);
    --ink:       oklch(0.22 0.025 50);
    --ink-soft:  oklch(0.42 0.020 50);
    --ink-mute:  oklch(0.58 0.015 55);
    --line:      oklch(0.89 0.012 60);
    --line-soft: oklch(0.93 0.010 60);
    --accent:        oklch(0.54 0.14 38);
    --accent-ink:    oklch(0.98 0.01 60);
    --accent-soft:   oklch(0.92 0.05 38);
    --success:       oklch(0.50 0.12 145);
    --success-soft:  oklch(0.93 0.06 145);
    --danger:        oklch(0.55 0.20 28);
    --danger-soft:   oklch(0.94 0.08 28);
    --shadow-sm: 0 1px 2px oklch(0.20 0.02 50 / 0.04), 0 0 0 1px oklch(0.20 0.02 50 / 0.04);
    --shadow-md: 0 8px 24px oklch(0.20 0.02 50 / 0.06), 0 1px 2px oklch(0.20 0.02 50 / 0.04);
    --radius:    18px;
    --radius-sm: 12px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:        oklch(0.18 0.015 50);
        --surface:   oklch(0.22 0.018 50);
        --paper:     oklch(0.25 0.020 50);
        --ink:       oklch(0.96 0.012 75);
        --ink-soft:  oklch(0.78 0.015 60);
        --ink-mute:  oklch(0.60 0.012 55);
        --line:      oklch(0.32 0.020 50);
        --line-soft: oklch(0.28 0.018 50);
        --accent:        oklch(0.70 0.15 38);
        --accent-ink:    oklch(0.18 0.015 50);
        --accent-soft:   oklch(0.34 0.08 38);
        --success-soft:  oklch(0.34 0.08 145);
        --danger-soft:   oklch(0.34 0.10 28);
        --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.4), 0 0 0 1px oklch(1 0 0 / 0.04);
        --shadow-md: 0 8px 24px oklch(0 0 0 / 0.45), 0 1px 2px oklch(0 0 0 / 0.4);
    }
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html, body { height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg, video, canvas { display: block; max-width: 100%; }

html {
    min-height: 100%;
    background: var(--bg);
}
body {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-feature-settings: 'cv11', 'ss01';
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background:
        radial-gradient(at 15% 0%, oklch(0.95 0.04 38 / 0.5) 0px, transparent 45%),
        radial-gradient(at 90% 100%, oklch(0.94 0.05 145 / 0.35) 0px, transparent 45%),
        var(--bg);
}

.serif { font-family: inherit; font-weight: 700; letter-spacing: -0.025em; }

/* ============ CARD ============ */
.container {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    padding: 40px 36px 36px;
    width: 100%;
    max-width: 440px;
    animation: fadeUp 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.container.wide { max-width: 560px; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============ HEADER ============ */
.logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin: 0 auto 18px;
    border: 1px solid oklch(from var(--accent) l c h / 0.18);
}
.brand {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin-bottom: 14px;
}
.container h1 {
    text-align: center;
    font-family: inherit;
    font-weight: 600;
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -0.025em;
    color: var(--ink);
    margin-bottom: 8px;
}
.container .subtitle {
    text-align: center;
    color: var(--ink-soft);
    font-size: 14px;
    margin-bottom: 28px;
}

/* ============ ALERT ============ */
.alert {
    display: none;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid transparent;
}
.alert-success {
    background: var(--success-soft);
    color: var(--success);
    border-color: oklch(from var(--success) l c h / 0.25);
}
.alert-error {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: oklch(from var(--danger) l c h / 0.25);
}

/* ============ FORM ============ */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="tel"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--paper);
    color: var(--ink);
    font-size: 15px;
    font-weight: 500;
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--ink-mute); font-weight: 400; }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 4px oklch(from var(--accent) l c h / 0.12);
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237a6655' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
}

.form-group input[type="file"] {
    padding: 10px 14px;
    cursor: pointer;
}
.form-group input[type="file"]::file-selector-button {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    padding: 6px 12px;
    border-radius: 8px;
    margin-right: 12px;
    font-weight: 600;
    font-size: 12.5px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.form-group input[type="file"]::file-selector-button:hover {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: oklch(from var(--accent) l c h / 0.3);
}

/* ============ OTP INPUT ============ */
.otp-input {
    text-align: center;
    font-family: 'Geist Mono', ui-monospace, monospace !important;
    font-size: 22px !important;
    letter-spacing: 0.5em !important;
    font-weight: 500 !important;
    padding-left: 0.5em !important;
}

/* ============ BUTTON ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 16px;
    background: var(--ink);
    color: var(--surface);
    border: 1.5px solid var(--ink);
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.08s, opacity 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) { opacity: 0.92; }
.btn:active:not(:disabled) { transform: scale(0.985); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid oklch(from var(--accent) l c h / 0.4); outline-offset: 2px; }

.btn-secondary {
    background: transparent;
    color: var(--ink);
    border: 1.5px solid var(--line);
    margin-top: 10px;
}
.btn-secondary:hover:not(:disabled) {
    background: var(--paper);
    border-color: var(--ink-mute);
    opacity: 1;
}

/* ============ LINKS / FOOTER ROW ============ */
.link {
    text-align: center;
    font-size: 13.5px;
    color: var(--ink-soft);
    margin-top: 22px;
}
.link a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.link a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ============ DIVIDER (form section) ============ */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-mute);
}
.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* ============ CAMERA SECTION ============ */
.camera-section {
    background: var(--paper);
    border: 1px dashed var(--line);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}
#webcam {
    width: 100%;
    border-radius: 10px;
    background: oklch(0.15 0.01 50);
    margin-bottom: 12px;
}
#canvas { display: none; }
.camera-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.camera-controls .btn { margin-top: 0; }

.captured-preview {
    display: none;
    position: relative;
    margin-top: 8px;
}
.captured-preview img {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--line);
}
.capture-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--success-soft);
    color: var(--success);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 10px;
}
.capture-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ============ MOBILE ============ */
@media (max-width: 480px) {
    body { padding: 16px 12px; align-items: flex-start; }
    .container { padding: 28px 22px 24px; border-radius: 16px; }
    .container h1 { font-size: 24px; }
    .logo { width: 48px; height: 48px; font-size: 22px; margin-bottom: 14px; }
}
