/* Shared by every page of the hub: colours, type, the header with its way home,
   cards, the status dot and sign-in. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #1b1f24;
  --muted: #687080;
  --track: #e9ecf1;
  --accent: #2f6fde;
  --ok: #1d8f4e;
  --warn: #b26a00;
  --bad: #cc3550;
  --idle: #8a93a1;
  --ok-soft: #e6f4ec;
  --warn-soft: #fbf0dc;
  --bad-soft: #fbe7eb;
  --idle-soft: #eef0f3;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.04), 0 1px 3px rgb(16 24 40 / 0.06);
  --shadow-raised: 0 2px 4px rgb(16 24 40 / 0.04), 0 8px 20px rgb(16 24 40 / 0.08);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --radius: 12px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --border: #272c35;
    --text: #e5e8ec;
    --muted: #98a0ac;
    --track: #252a33;
    --accent: #5b8ff0;
    --ok: #42c07a;
    --warn: #e3a440;
    --bad: #f0687f;
    --idle: #8a93a1;
    --ok-soft: #15291e;
    --warn-soft: #2e2413;
    --bad-soft: #321820;
    --idle-soft: #1f232a;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.35);
    --shadow-raised: 0 2px 4px rgb(0 0 0 / 0.35), 0 10px 24px rgb(0 0 0 / 0.4);
  }
}

/* Moving between the home page and the apps cross-fades where browsers can. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 0.9375rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main, .top, .footer {
  max-width: 1920px;
  margin: 0 auto;
  padding: 0 16px;
}

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* The way home, above an app's title: "Hub / Docs / project". */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; font-size: 0.8125rem; color: var(--muted); }
.crumbs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-block-size: 24px;
  color: inherit;
  font-weight: 500;
  text-decoration: none;
  border-radius: 6px;
}
.crumbs a:hover { color: var(--accent); }
.crumbs img { inline-size: 18px; block-size: 18px; }

.top-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
h1 { font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem); margin: 0; letter-spacing: -0.015em; text-wrap: balance; }
h1.brand { display: flex; align-items: center; gap: 10px; }
h1.brand img { inline-size: 1.25em; block-size: 1.25em; }
h2 { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 600; margin: 32px 0 12px; }
.count {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--idle-soft);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.count:empty { display: none; }

button {
  font: inherit;
  font-size: 0.875rem;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
button.ghost { background: var(--surface); color: var(--muted); border-color: var(--border); }
button.ghost:hover:not(:disabled) { color: var(--text); border-color: var(--idle); }
button:disabled { opacity: 0.6; cursor: default; }

:where(a:any-link, button, select, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.status { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 0.875rem; color: var(--muted); }
.status-text { flex: 1; min-width: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--idle); flex: none; }
.status.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.status.warn .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.status.bad .dot { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.status.wait .dot { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.status.bad .status-text { color: var(--bad); font-weight: 600; }
@keyframes pulse { 50% { opacity: 0.25; } }

.chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--muted);
}
.chip b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.chip.bad b { color: var(--bad); }
.card .chip { background: var(--bg); }

.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 26.25rem), 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  min-width: 0;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.name { font-weight: 600; overflow-wrap: anywhere; }
h3.name { margin: 0; font-size: 1rem; }
.id { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.meta { font-size: 0.8125rem; color: var(--muted); margin: 2px 0 0; overflow-wrap: anywhere; }

/* A card that is one link: the apps on the home page, the pages in Docs. */
.card-link { display: block; color: inherit; text-decoration: none; border-radius: var(--radius); }
.card-link > .card { block-size: 100%; transition: border-color 0.15s, box-shadow 0.15s, translate 0.15s; }
.card-link:hover > .card { border-color: color-mix(in oklab, var(--accent) 45%, var(--border)); box-shadow: var(--shadow-raised); }
.card-link .go { color: var(--muted); transition: color 0.15s, translate 0.15s; }
.card-link:hover .go { color: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .card-link:hover > .card { translate: 0 -1px; }
  .card-link:hover .go { translate: 2px 0; }
}

.empty { padding: 14px; color: var(--muted); font-size: 0.875rem; }

.footer { color: var(--muted); font-size: 0.75rem; padding-top: 32px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.footer a { color: inherit; }

/* Home page: one card per app, its icon (web/icon.svg) beside the text. */
.app { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; }
.app > img { grid-row: 1 / span 4; inline-size: 40px; block-size: 40px; }
.app > :not(img) { grid-column: 2; }
.card .status { margin-top: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-raised);
  padding: 24px 20px;
  display: grid;
  gap: 10px;
}
.login h1 { margin-bottom: 8px; }
.login label { font-size: 0.8125rem; color: var(--muted); }
.login input {
  font: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.login input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.login button { padding: 10px; font-size: 0.9375rem; }
.login-error { margin: 0; color: var(--bad); font-size: 0.875rem; }
.login-note { margin: 4px 0 0; color: var(--muted); font-size: 0.78125rem; text-align: center; }
