/* The look BrainSpace shares with the sign-in pages of its sync server: colors (light and dark), type, form
   controls and panels. The server serves this file as it is (server/internal/server/assets/theme.css is a copy:
   run `pnpm server:assets` after a change here, the server's tests fail until then). Only what a plain page
   can use belongs here; everything about the app's own layout stays in styles.css. */
:root {
  color-scheme: light dark;
  --bg-base: #f4f5f9;
  --surface: #ffffff;
  --surface-2-base: #eef0f6;
  --text: #171a22;
  --muted: #697184;
  --border-base: #e2e5ee;
  --accent: #5b5bf0;
  --accent-text: #ffffff;
  --new: #2563eb;
  --learning: #dc2626;
  --review: #15803d;
  --again: #e5484d;
  --hard: #d97706;
  --good: #16a34a;
  --easy: #2563eb;
  --shadow: 0 1px 0.1333rem #1b1f2a0d, 0 0.5333rem 1.8667rem #1b1f2a12;
  --radius: 0.9333rem;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* 15px of the browser's 16px; every rem below is relative to it */
  font-size: 93.75%;
  -webkit-font-smoothing: antialiased;
}
/* derived colors; the Settings page can tint the background and change the accent */
:root, :root[data-theme] {
  --bg: var(--bg-base);
  --surface-2: var(--surface-2-base);
  --border: var(--border-base);
  --sidebar-bg: var(--surface);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
}
:root[data-tinted] {
  --bg: color-mix(in srgb, var(--tint) 11%, var(--bg-base));
  --surface-2: color-mix(in srgb, var(--tint) 9%, var(--surface-2-base));
  --border: color-mix(in srgb, var(--tint) 14%, var(--border-base));
  --sidebar-bg: color-mix(in srgb, var(--tint) 6%, var(--surface));
}
:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='dark'] { color-scheme: dark; }
:root[data-density='compact'] { font-size: 87.5%; --gap: 1.2rem; --pad: 1.0667rem; }
:root { --gap: 2rem; --pad: 1.6rem; --sidebar-w: 17.6rem; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg-base: #0d0f14;
    --surface: #161920;
    --surface-2-base: #1f232c;
    --text: #e9ebf1;
    --muted: #9099aa;
    --border-base: #272b36;
    --accent: #8b8cf8;
    --accent-text: #0d0f14;
    --new: #60a5fa;
    --learning: #f87171;
    --review: #4ade80;
    --again: #f0605f;
    --hard: #fbbf24;
    --good: #4ade80;
    --easy: #60a5fa;
    --shadow: 0 1px 0.1333rem #0006, 0 0.6667rem 2rem #0005;
  }
}
:root[data-theme='dark'] {
  --bg-base: #0d0f14;
  --surface: #161920;
  --surface-2-base: #1f232c;
  --text: #e9ebf1;
  --muted: #9099aa;
  --border-base: #272b36;
  --accent: #8b8cf8;
  --accent-text: #0d0f14;
  --new: #60a5fa;
  --learning: #f87171;
  --review: #4ade80;
  --again: #f0605f;
  --hard: #fbbf24;
  --good: #4ade80;
  --easy: #60a5fa;
  --shadow: 0 1px 0.1333rem #0006, 0 0.6667rem 2rem #0005;
}
/* after the dark theme, which uses dark text on its light accent */
html:root[data-custom-accent] { --accent-text: #ffffff; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
h1:where(:not(.chat-ui *)) { margin: 0; font-size: 1.6rem; letter-spacing: -0.02em; }
h2:where(:not(.chat-ui *)) { margin: 0 0 0.6667rem; font-size: 1.05rem; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
::selection { background: var(--accent-soft); }

/* controls; a.button is a link that looks like a button (the sync server's pages have them) */
button:where(:not([data-slot])), a.button, input:where(:not([data-slot])), select:where(:not([data-slot])), textarea:where(:not([data-slot])) {
  font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--border); border-radius: 0.6rem; padding: 0.5333rem 0.8667rem;
  transition: background 0.12s, border-color 0.12s, filter 0.12s, box-shadow 0.12s;
}
/* WebKit draws a native pop-up button for <select>; this one looks like the other fields, with a chevron */
select {
  -webkit-appearance: none; appearance: none; padding-right: 2.2rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%238b8798' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 0.8rem;
}
input:where(:not([data-slot])):hover, select:where(:not([data-slot])):hover, textarea:where(:not([data-slot])):hover { border-color: color-mix(in srgb, var(--muted) 45%, var(--border)); }
input:where(:not([data-slot])):focus, select:where(:not([data-slot])):focus, textarea:where(:not([data-slot])):focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 0.2rem var(--accent-soft); }
button:where(:not([data-slot])), a.button { cursor: pointer; font-weight: 500; }
a.button { display: inline-block; text-align: center; text-decoration: none; }
button:where(:not([data-slot])):hover:not(:disabled), a.button:hover { background: var(--surface-2); }
button:where(:not([data-slot])):active:not(:disabled), a.button:active { transform: translateY(1px); }
button:where(:not([data-slot])):disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
button.danger { color: var(--again); border-color: color-mix(in srgb, var(--again) 55%, var(--border)); }
button.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--again) 12%, transparent); }
button.link { border: 0; background: none; padding: 0; text-align: left; }
button.link:hover { text-decoration: underline; background: none; }
button:where(:not([data-slot])):focus-visible, a.button:focus-visible { outline: 0.1333rem solid var(--accent); outline-offset: 0.1333rem; }
textarea:where(:not([data-slot])) { width: 100%; resize: vertical; line-height: 1.45; }
input[type='search'], .inline-form input { min-width: 15.3333rem; }
input[type='range'] { padding: 0; width: 100%; accent-color: var(--accent); box-shadow: none; }
input[type='checkbox'] { accent-color: var(--accent); }
.form-grid { display: grid; gap: 1.0667rem; }
.form-grid label { display: grid; gap: 0.4rem; font-weight: 600; font-size: 0.88rem; }
.form-grid label.check { display: flex; align-items: center; gap: 0.5333rem; font-weight: 500; }
.form-grid label.check input { width: auto; }
.form-grid .hint { font-weight: 400; font-style: normal; color: var(--muted); margin-left: 0.2667rem; }
.form-grid .muted.small { font-weight: 400; }

/* surfaces */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3333rem; box-shadow: var(--shadow); }
.panel p { margin: 0 0 0.8rem; }
