/* site.css: shared by the viewer and the site pages (landing, login, admin) */

:root {
    color-scheme: dark;
    --bg: #0e1014;
    --surface: #161920;
    --surface-2: #1d2129;
    --surface-3: #262b35;
    --border: #2a2f3a;
    --border-strong: #3a4150;
    --text: #e8eaf0;
    --muted: #98a1b2;
    --faint: #6b7385;
    --accent: #f2a541;
    --accent-strong: #e6922a;
    --accent-soft: rgba(242, 165, 65, 0.15);
    --on-accent: #1a1206;
    --good: #3ecf8e;
    --warn: #f5b84b;
    --bad: #f2626b;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
    --radius: 10px;
    --radius-sm: 7px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        color-scheme: light;
        --bg: #f4f5f8;
        --surface: #ffffff;
        --surface-2: #eef0f4;
        --surface-3: #e3e6ed;
        --border: #dde1e8;
        --border-strong: #c7ccd6;
        --text: #161a22;
        --muted: #5b6475;
        --faint: #8a92a3;
        --accent: #c96f0e;
        --accent-strong: #ad5d08;
        --accent-soft: rgba(201, 111, 14, 0.12);
        --on-accent: #ffffff;
        --good: #179c64;
        --warn: #b7791f;
        --bad: #d43d48;
        --shadow: 0 10px 30px rgba(20, 26, 40, 0.12), 0 2px 6px rgba(20, 26, 40, 0.08);
    }
}

* {
    box-sizing: border-box;
}

/* components below set display, which would otherwise beat the hidden attribute */
[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    line-height: 1.2;
    margin: 0;
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

code, kbd {
    font-family: var(--mono);
    font-size: 0.88em;
}

kbd {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--surface-2);
    white-space: nowrap;
}

.muted {
    color: var(--muted);
}

.icon {
    width: 18px;
    height: 18px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---- buttons ---- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-weight: 550;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s, transform 0.06s;
}

.btn:hover {
    background: var(--surface-3);
    text-decoration: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.btn.primary {
    background: var(--accent);
    border-color: transparent;
    color: var(--on-accent);
}

.btn.primary:hover {
    background: var(--accent-strong);
}

.btn.danger {
    color: var(--bad);
}

.btn.ghost {
    background: none;
    border-color: transparent;
}

.btn.ghost:hover {
    background: var(--surface-2);
}

.btn.small {
    height: 30px;
    padding: 0 10px;
    font-size: 13px;
}

.btn.large {
    height: 46px;
    padding: 0 22px;
    font-size: 16px;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---- forms ---- */

.input, select.input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.field {
    display: grid;
    gap: 6px;
}

.field > span {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    cursor: pointer;
}

.check input {
    margin-top: 4px;
    accent-color: var(--accent);
}

/* ---- cards and pills ---- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 11px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--faint);
    flex: none;
}

.dot.good { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }
.dot.ok { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }

.alert {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--bad) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
    color: var(--text);
    font-size: 14px;
}

/* ---- dialogs ---- */

dialog.sheet {
    width: min(520px, calc(100% - 32px));
    max-height: calc(100% - 48px);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

dialog.sheet::backdrop {
    background: rgba(5, 7, 12, 0.55);
    backdrop-filter: blur(2px);
}

dialog.sheet[open] {
    animation: pop 0.14s ease-out;
}

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 12px 20px;
    border-bottom: 1px solid var(--border);
}

.sheet-head h2 {
    font-size: 16px;
}

.sheet-body {
    display: grid;
    gap: 16px;
    padding: 18px 20px 20px;
}

@keyframes pop {
    from { opacity: 0; transform: translateY(6px) scale(0.98); }
}

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

.spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid var(--surface-3);
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition: none !important;
    }
}
