/* The base stylesheet every page imports: a small reset, the components, and a
 * default set of tokens. On its own it is plain, like a reset with reasonable
 * defaults: a serif body, blue underlined links, black text on white. A theme
 * stylesheet sets the tokens to give a page its look. */

:root {
  /* Plain browser defaults: the serif is Times New Roman on most systems. */
  --font-body: serif;
  --font-head: var(--font-body);
  --font-mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --fs-body: 1rem;
  --fs-small: 0.85rem;
  --fs-h2: 1.15rem;
  --fs-h1: 1.6rem;
  --lh: 1.5;
  --h1-weight: 700;
  --h1-spacing: 0;

  --bg: #ffffff;
  --surface: #ffffff;
  --sunk: #f0f0f0;
  --ink: #000000;
  --muted: #444444;
  --faint: #767676;
  --border: #cccccc;
  --border-strong: #999999;

  --accent: #0000ee;
  --accent-ink: #ffffff;
  --accent-weak: #eeeeff;
  --danger: #cc0000;

  --radius: 0px;
  --radius-sm: 0px;
  --shadow: none;
  --card-border: var(--border);

  --measure: 34rem;
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page, main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3.5rem 1.25rem 5rem;
}

h1 {
  font-family: var(--font-head);
  font-weight: var(--h1-weight);
  font-size: var(--fs-h1);
  line-height: 1.15;
  letter-spacing: var(--h1-spacing);
  margin: 0 0 1rem;
}
h2 {
  font-family: var(--font-head);
  font-size: var(--fs-h2);
  font-weight: 600;
  line-height: 1.25;
  margin: 2rem 0 0.6rem;
}
p { margin: 0 0 0.9rem; }

a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: var(--fs-small); }
.mono, code, .id, .handle {
  font-family: var(--font-mono);
  font-size: 0.84em;
  font-variant-numeric: normal;
}
.id { color: var(--muted); word-break: break-all; }

::selection { background: var(--accent-weak); }
:where(a, button, input, select, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Controls ------------------------------------------------------------- */

label {
  display: block;
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 0.3rem;
}

input[type="text"], input[type="password"], input:not([type]), select, textarea {
  font: inherit;
  width: 100%;
  padding: 0.5rem 0.6rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color 0.12s, box-shadow 0.12s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}

button, .btn {
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.03s;
}
button:hover, .btn:hover { border-color: var(--accent); color: var(--accent); }
button:active, .btn:active { transform: translateY(0.5px); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { filter: brightness(1.08); color: var(--accent-ink); border-color: var(--accent); }

.btn-text {
  background: none;
  border: none;
  padding: 0.2rem 0;
  color: var(--accent);
  text-decoration: none;
}
.btn-text:hover { text-decoration: underline; color: var(--accent); }

/* A quiet text control for removing an item. Text, not a glyph, so it reads. */
.remove {
  padding: 0 0.25rem;
  font: inherit;
  font-size: var(--fs-small);
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
}
.remove:hover { color: var(--danger); text-decoration: underline; border-color: transparent; }

/* --- Pieces --------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.15rem 1.3rem;
  box-shadow: var(--shadow);
}

.tag {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-variant-numeric: normal;
  color: var(--muted);
  background: var(--sunk);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.5rem;
}
.tag-accent { color: var(--accent-ink); background: var(--accent); }

/* A boxed message, for example that a list is not shared with you. */
.notice {
  background: var(--sunk);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin-bottom: 1.5rem;
}
.notice p { margin: 0 0 0.35rem; }
.notice p:last-child { margin: 0; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 2rem; }
.status { min-height: 1.4rem; margin-top: 1rem; color: var(--danger); }
hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
[hidden] { display: none !important; }

/* The per-app connection readout: a small fixed overlay a person can read at a
 * glance without it taking a click or covering the app. Non-interactive, so it
 * never blocks a control beneath it. */
.conninfo {
  position: fixed;
  bottom: 0.5rem;
  left: 0.5rem;
  z-index: 9999;
  max-width: 90vw;
  padding: 0.2rem 0.4rem;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  pointer-events: none;
  white-space: pre-wrap;
}
