/* Reset and layout primitives shared by every web_pjs page. Uses the tokens in theme.css. */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--size-m)/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: var(--text); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
[hidden] { display: none !important; }

.stack > * + * { margin-top: var(--gap, var(--space-3)); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--space-3)); }
.grid { display: grid; gap: var(--gap, var(--space-4)); grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.container { width: 100%; max-width: var(--content); margin-inline: auto; padding-inline: var(--space-4); }
.dim { color: var(--text-dim); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* components (see lib/ui/) */
.btn { font: inherit; font-size: var(--size-s); font-weight: 600; padding: 10px 18px; min-height: 40px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; }
.btn:hover { border-color: var(--text-dim); color: var(--text); }
.btn:focus-visible { box-shadow: var(--focus); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #ffc965; border-color: #ffc965; color: var(--accent-ink); }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.btn-quiet { border-color: transparent; }

.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field label { font-size: var(--size-s); color: var(--text-dim); }
.field input { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 44px; }
.field input:focus-visible { border-color: var(--accent); box-shadow: var(--focus); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field .hint { font-size: var(--size-s); color: var(--text-dim); }
.field .error { font-size: var(--size-s); color: var(--danger); min-height: 1.2em; }
.form-error { color: var(--danger); font-size: var(--size-s); min-height: 1.2em; }

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

.toasts { position: fixed; right: var(--space-3); bottom: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); z-index: 50; max-width: calc(100vw - 2 * var(--space-3)); }
.toast { background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--text-dim); padding: 10px 14px; border-radius: 8px; font-size: var(--size-s); }
.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.8); display: flex; align-items: center; justify-content: center; padding: var(--space-3); z-index: 40; }
.modal { width: min(100%, 880px); max-height: 100%; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

.empty { text-align: center; color: var(--text-dim); padding: var(--space-5) var(--space-3); border: 1px dashed var(--line); border-radius: var(--radius); }
