/* BB Platform — design system (docs/07-design.md).
   Light theme by default; dark theme via prefers-color-scheme AND via
   html[data-theme="dark"] (the data-theme attribute wins over the media
   query). All colors go through CSS variables. No external fonts/assets. */

/* --- Design tokens (light) ---------------------------------------------- */

:root {
    --ink: #10243a;
    --muted: #526477;
    --line: #dae4ed;
    --paper: #ffffff;
    --wash: #f2f6fa;
    --nav: #101f34;
    --navmuted: #9eb0c5;
    --brand: #0069d6;
    --brand-hover: #0057b3;
    --cyan: #71e8ec;
    --focus: #0879e8;
    --danger: #8d2018;
    --danger-bg: #fff0ed;
    --side-bg: #ffffff;
    --side-ink: #10243a;
    --side-muted: #526477;
    --side-hover: #eef4fa;
    --side-active: #e3eefb;
    --side-border: #dae4ed;
    --radius: 18px;
    --radius-sm: 10px;
    --shadow: 0 2px 3px #10243a05, 0 8px 30px #10243a05;
    --font-stack: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Dark theme: system preference (media query) */
@media (prefers-color-scheme: dark) {
    :root {
        --ink: #e6edf5;
        --muted: #9fb0c2;
        --line: #2a3a4d;
        --paper: #152131;
        --wash: #0e1824;
        --nav: #0a1420;
        --side-bg: #0a1420;
        --side-ink: #e6edf5;
        --side-muted: #9eb0c5;
        --side-hover: #16304a;
        --side-active: #1b3c57;
        --side-border: #1c3350;
    }
}

/* Dark theme: explicit choice via html[data-theme] — wins over the
   media query above (higher specificity). */
html[data-theme="dark"] {
    --ink: #e6edf5;
    --muted: #9fb0c2;
    --line: #2a3a4d;
    --paper: #152131;
    --wash: #0e1824;
    --nav: #0a1420;
    --side-bg: #0a1420;
    --side-ink: #e6edf5;
    --side-muted: #9eb0c5;
    --side-hover: #16304a;
    --side-active: #1b3c57;
    --side-border: #1c3350;
}

/* Light theme: explicit choice via html[data-theme="light"] — wins over
   the media query. */
html[data-theme="light"] {
    --ink: #10243a;
    --muted: #526477;
    --line: #dae4ed;
    --paper: #ffffff;
    --wash: #f2f6fa;
    --nav: #101f34;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-stack);
    font-size: 16px;
    line-height: 1.5;
    background: var(--wash);
    color: var(--ink);
}

h1, h2, h3 {
    line-height: 1.25;
    letter-spacing: -0.03em;
}

a {
    color: var(--brand);
}

a, button, input, select, textarea {
    font-family: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

main.container {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
}

/* --- Header / navigation ------------------------------------------------- */

.site-header {
    background: var(--nav);
    border-bottom: 1px solid var(--line);
}

.nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    min-height: 56px;
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--paper);
    text-decoration: none;
    margin-right: 1rem;
    letter-spacing: -0.03em;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    flex: 1;
}

.nav-links a {
    color: var(--navmuted);
    text-decoration: none;
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
}

.nav-links a:hover {
    background: #1b3c57;
    color: var(--paper);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.lang-form {
    display: flex;
    gap: 0.25rem;
}

/* --- Buttons --------------------------------------------------------------- */

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover {
    background: var(--wash);
}

.btn-sm {
    padding: 0.25rem 0.6rem;
    min-height: 0;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
}

.btn-secondary {
    background: var(--paper);
    border-color: var(--brand);
    color: var(--brand);
}

.btn-secondary:hover {
    background: var(--wash);
}

.btn-quiet {
    border-color: transparent;
    background: transparent;
    color: var(--muted);
}

.btn-quiet:hover {
    background: var(--wash);
    color: var(--ink);
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #6f1a14;
    border-color: #6f1a14;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

form label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    max-width: 480px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--paper);
    color: var(--ink);
    font: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
    border-color: var(--brand);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.field {
    margin-bottom: 1rem;
}

.field-error {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 400;
}

.checkbox {
    width: auto;
    max-width: none;
}

.inline-form {
    display: inline;
}
/* --- Small screens -------------------------------------------------------------------------------------- */

@media (max-width: 640px) {
    .nav {
        min-height: auto;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .nav-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }
}
