/* Shared base for the exocortex web apps: gray tokens for light and dark
   (no pure black or white, moderate contrast), one tint per app for
   recognizability, neutral controls. An app sets --tint; everything still
   reads without it and in grayscale. State is never shown by hue alone or by
   a change of font weight. */
:root {
  color-scheme: light dark;
  --bg: #efefef;
  --surface: #f8f8f8;
  --sunken: #e3e3e3;
  --ink: #262626;
  --ink-2: #585858;
  --ink-3: #7c7c7c;
  --line: #d2d2d2;
  --line-2: #a4a4a4;
  --hover: #e6e6e6;
  --tint: var(--ink-2);
  --focus: var(--tint);
  --radius: 3px;
  --control: 30px;
  --gutter: 16px;
  --fs: 14px;
  --fs-s: 12px;
  font: var(--fs)/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1c;
    --surface: #262626;
    --sunken: #303030;
    --ink: #dadada;
    --ink-2: #a8a8a8;
    --ink-3: #828282;
    --line: #3b3b3b;
    --line-2: #626262;
    --hover: #323232;
  }
}
@media (max-width: 760px), (pointer: coarse) {
  :root { --control: 38px; --fs: 15px; --fs-s: 12.5px; --gutter: 12px; }
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 0; overflow-wrap: anywhere; background: var(--bg); }
a { color: inherit; text-decoration-color: var(--line-2); text-underline-offset: 2px; }
p { margin: .5rem 0; }
h1 { font-size: 1.2rem; }
h2 { font-size: 1.08rem; }
h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; }
small { color: var(--ink-2); font-size: var(--fs-s); }
pre { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: var(--ink); border-radius: var(--radius); }
button { min-height: var(--control); min-width: var(--control); padding: 0 .6rem; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; }
button:hover { background: var(--hover); }
button:disabled { color: var(--ink-3); border-color: var(--line); cursor: default; }
input:not([type=hidden]), textarea, select { width: 100%; min-height: var(--control); padding: .25rem .4rem; border: 1px solid var(--line-2); background: var(--surface); }
textarea { resize: vertical; }
form { margin: 0; }
label { display: block; color: var(--ink-2); font-size: var(--fs-s); }

/* Page frame: the tinted bar is what tells the apps apart. */
header { display: flex; gap: .75rem; align-items: center; min-height: calc(var(--control) + .4rem); padding: .2rem var(--gutter); background: var(--sunken); background: color-mix(in oklab, var(--bg) 84%, var(--tint)); border-bottom: 1px solid var(--line-2); border-bottom-color: color-mix(in oklab, var(--line-2) 55%, var(--tint)); }
header > a { font-weight: 600; text-decoration: none; }
header nav { flex: 1; min-width: 0; }
header form button { border-color: transparent; background: none; color: var(--ink-2); font-size: var(--fs-s); }
main { padding: .6rem var(--gutter) 3rem; max-width: 100rem; margin: 0 auto; }
main > h1, main > h2 { margin: 1rem 0 .3rem; font-size: 1rem; }
main > h1:first-child { margin-top: .2rem; }
/* The login form is the only form directly in main. */
main > form { display: grid; gap: .6rem; max-width: 20rem; }
main > [role=alert]:empty { display: none; }
