/* OpenSubspace visual system: one stylesheet for the console and the public site.
 *
 * Served at the same path on both origins, /console/oss.css:
 *   gateway.opensubspace.dev  -> apps/gateway/public/console/oss.css (console static route)
 *   opensubspace.dev          -> apps/web/console/oss.css (published with apps/web)
 * The two files must stay byte-identical, and so must the two console/fonts/ directories;
 * fixtures/design-system-parity.mjs fails if they drift.
 *
 * Direction: a blue-black ground, a cool grey body and a signal-cyan accent, with amber and violet as
 * secondary signals. Display type (Poppins) is heavy with tight tracking; body type is IBM Plex Sans;
 * eyebrows are small caps with wide tracking. Surfaces are glassy cards with hairline borders that
 * lift and pick up a violet edge on hover; primary actions glow cyan on hover.
 *
 * Fonts are self-hosted Latin WOFF2 subsets in /console/fonts/ (SIL Open Font License 1.1; the
 * licence texts sit next to the files). Nothing is fetched from another origin, so no font CDN sees
 * who visits. Dark only, declared with color-scheme so form controls and scrollbars match.
 */
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/poppins-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/poppins-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 800; font-display: swap; src: url("fonts/poppins-latin-800-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/ibm-plex-mono-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: dark;
  /* colour */
  --bg: #080c10;
  --bg-raised: #0d1219;
  --bg-panel: #111827;
  --bg-card: rgba(13, 18, 25, 0.85);
  --bg-card-subtle: rgba(13, 18, 25, 0.5);
  --ink: #e8edf2;
  --body: #c3ccd7;
  --muted: #94a3b8;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --line-solid: #1b222b;
  /* Form-field boundaries (WCAG 1.4.11): >= 3:1 against --bg, --bg-raised and --bg-panel in every state.
     fixtures/design-system-parity.mjs measures these. */
  --field-border: #6b7a8d;
  --field-border-hover: #94a3b8;
  --accent: #00c2ff;
  --accent-hover: #00a8e0;
  --accent-ink: #080c10;
  --accent-glow: rgba(0, 194, 255, 0.12);
  --accent-edge: rgba(0, 194, 255, 0.22);
  --accent-tint: rgba(0, 194, 255, 0.08);
  --amber: #f59e0b;
  --amber-tint: rgba(245, 158, 11, 0.12);
  --violet: #a088d4;
  --violet-mid: #8b6fbf;
  --violet-dim: rgba(91, 75, 138, 0.15);
  --violet-edge: rgba(91, 75, 138, 0.45);
  --ok: #34d399;
  --danger: #ffb4a8;
  --danger-tint: rgba(255, 180, 168, 0.08);
  --nav-bg: rgba(6, 6, 11, 0.72);
  /* type */
  --font: "IBM Plex Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Poppins", "IBM Plex Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-xs: 0.72rem;
  --text-sm: 0.875rem;
  --text-md: 1.0625rem;
  --text-lg: 1.2rem;
  /* space */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2.5rem;
  --s7: 5rem;
  /* shape */
  --measure: 42rem;
  --wide: 67.5rem;
  --radius: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 28px;
  /* depth */
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 32px rgba(0, 0, 0, 0.35);
  --glow-accent: 0 8px 32px rgba(0, 194, 255, 0.25);
  --glow-violet: 0 0 120px 40px rgba(91, 75, 138, 0.15);
  --hairline: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.35), transparent);
  /* motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --fast: 0.2s;
  --slow: 0.3s;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 70% 40% at 15% -5%, rgba(91, 75, 138, 0.16), transparent 70%),
    radial-gradient(ellipse 60% 35% at 95% 0%, rgba(0, 194, 255, 0.07), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--body);
  font-family: var(--font);
  line-height: 1.7;
  overflow-wrap: break-word;
}
::selection { background: var(--accent); color: var(--accent-ink); }
strong, b { color: var(--ink); font-weight: 600; }
h1, h2, h3, h4 { color: var(--ink); font-family: var(--font-display); }

/* ── links ───────────────────────────────────────────────────────────── */
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: color var(--fast) ease; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ── top bar: brand, page title, nav (frosted, as on the source site) ─ */
.top {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3) 1.5rem;
  padding: var(--s4) 2rem;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
/* The OpenSubspace diamond (the favicon mark), drawn in CSS: decorative, no text. */
.brand::before {
  content: "";
  flex: none;
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid var(--accent);
  border-radius: 2px;
  transform: rotate(45deg);
  box-shadow: 0 0 12px rgba(0, 194, 255, 0.45);
}
.brand:hover { color: var(--ink); text-decoration: none; }
.top h1 { font-size: 0.95rem; font-weight: 600; margin: 0; letter-spacing: 0; color: var(--muted); }
.nav, .session-bar {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) 1.75rem;
  align-items: center;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.nav a, .session-bar a { color: var(--muted); text-decoration: none; }
.nav a:hover, .session-bar a:hover { color: var(--ink); }
.nav a.action, .session-bar a.action {
  color: var(--accent-ink);
  border-radius: var(--radius);
  padding: 0.45rem 1.1rem;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0;
}
.nav a.action:hover, .session-bar a.action:hover { color: var(--accent-ink); }

/* ── type ────────────────────────────────────────────────────────────── */
p { line-height: 1.7; }
h2 { font-size: 1.6rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.025em; }
h3 { margin: var(--s5) 0 var(--s1); font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; }
code, kbd, samp, pre { font-family: var(--mono); font-size: 0.9em; }
code { color: var(--accent); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.error { color: var(--danger); min-height: 1.4em; font-family: var(--mono); }

/* ── controls: solid cyan button that glows on hover, quiet outline variant ── */
button, .action {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 0.6rem 1.4rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--fast) ease, border-color var(--fast) ease, color var(--fast) ease, box-shadow var(--slow) ease, transform var(--fast) var(--ease);
}
button:hover, .action:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); transform: translateY(-1px); box-shadow: var(--glow-accent); text-decoration: none; }
button:active, .action:active { transform: translateY(0); box-shadow: none; }
button:disabled, button:disabled:hover { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.danger, .danger:hover { background: transparent; color: var(--danger); border: 1px solid var(--danger); box-shadow: none; }
.danger:hover:not(:disabled) { background: var(--danger-tint); }
input, select, textarea {
  font: inherit;
  background: var(--bg-raised);
  color: var(--ink);
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  transition: border-color var(--fast) ease, box-shadow var(--fast) ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--field-border-hover); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
input::placeholder, textarea::placeholder { color: #7d8a9c; }

/* ── layout primitives ───────────────────────────────────────────────── */
.stack { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }
.empty { border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); padding: var(--s5); background: var(--bg-card-subtle); }
.row {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-card-subtle);
  padding: var(--s2) var(--s5);
  margin: var(--s3) 0;
  transition: border-color var(--slow) ease, background-color var(--slow) ease;
}
.row:hover { border-color: var(--violet-edge); background: var(--violet-dim); }
.row p { margin: 0.4rem 0; }

/* ═══ Public pages ═════════════════════════════════════════════════════
 * Long-form pages share one column: a frosted sticky header, a wide container with a readable
 * measure, fading hairlines between sections and glassy cards for asides, tiers and code.
 * Element rules sit under :where(.page) so a class (.meta, .price, .label) always wins.
 */
.page { max-width: var(--wide); margin: 0 auto; padding: 4rem 2rem var(--s7); }
.page > * { max-width: var(--measure); }
:where(.page) h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 var(--s4);
}
:where(.page) h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); margin: var(--s6) 0 var(--s3); }
:where(.page) h3 { font-size: 1.05rem; margin: var(--s5) 0 var(--s2); }
:where(.page) p, :where(.page) li { font-size: var(--text-md); line-height: 1.75; }
:where(.page) ul, :where(.page) ol { padding-left: 1.25rem; }
:where(.page) li { margin: 0 0 var(--s2); }
:where(.page) li::marker { color: var(--accent); }
:where(.page) section { position: relative; margin-top: var(--s7); padding-top: var(--s2); }
:where(.page) section::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--hairline); }
:where(.page section) > h2:first-child { margin-top: var(--s6); }
.lede { color: var(--muted); font-size: var(--text-lg); line-height: 1.75; }
.meta { font-family: var(--mono); font-size: var(--text-sm); color: var(--muted); letter-spacing: 0.02em; }
/* Eyebrow pill: small caps, wide tracking, cyan on a cyan glow. */
.label {
  display: inline-block;
  font-family: var(--font);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid var(--accent-edge);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
}
.label.quiet { color: var(--muted); background: transparent; border-color: var(--line-strong); }
/* A callout: amber rule on the left, a slate-to-violet panel behind (the source's quote block). */
.aside {
  border-left: 3px solid var(--amber);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: linear-gradient(135deg, var(--bg-panel), rgba(91, 75, 138, 0.15));
  padding: var(--s5) var(--s5) var(--s5) 1.75rem;
  margin: var(--s6) 0;
}
.aside > :first-child { margin-top: 0; }
.aside > :last-child { margin-bottom: 0; }
pre, .terminal {
  font-family: var(--mono);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--accent);
  background: rgba(8, 12, 16, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--s5);
  overflow-x: auto;
}
.price { font-family: var(--font-display); font-size: 3rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: var(--amber); margin: var(--s5) 0 var(--s3); }
.tier { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; color: var(--ink); margin: 0 0 var(--s2); }
/* Rows of name / detail / state, separated by hairlines, in one card. */
.ledger { list-style: none; padding: 0; margin: var(--s5) 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg-card-subtle); box-shadow: var(--shadow-card); overflow: hidden; }
.ledger > li, .ledger > .ledger-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s1) var(--s5);
  padding: var(--s4) var(--s5);
  margin: 0;
  border-bottom: 1px solid var(--line);
}
.ledger > li:last-child, .ledger > .ledger-row:last-child { border-bottom: 0; }
.ledger .name { font-weight: 600; color: var(--ink); }
.ledger .detail { grid-column: 1; font-family: var(--mono); font-size: var(--text-sm); color: var(--muted); }
.ledger .state { grid-column: 2; grid-row: 1 / span 2; font-family: var(--mono); font-size: var(--text-sm); color: var(--muted); text-align: right; max-width: 18rem; }
.ledger .head { font-family: var(--font); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
@media (max-width: 600px) {
  .ledger > li, .ledger > .ledger-row { grid-template-columns: 1fr; padding: var(--s4); }
  .ledger .state { grid-column: 1; grid-row: auto; text-align: left; max-width: none; }
}
.columns { display: grid; gap: var(--s5); grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.columns > * {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-card-subtle);
  padding: var(--s5);
  transition: border-color var(--slow) ease, background-color var(--slow) ease, transform var(--slow) var(--ease), box-shadow var(--slow) ease;
}
.columns > *:hover { border-color: var(--violet-mid); background: var(--violet-dim); transform: translateY(-4px); box-shadow: var(--shadow-card); }
.columns > * > :first-child { margin-top: 0; }
.columns > * > :last-child { margin-bottom: 0; }
.page > .columns, .page > .wide { max-width: none; }

/* ── site footer ─────────────────────────────────────────────────────── */
.foot {
  position: relative;
  padding: 3rem max(2rem, calc((100% - var(--wide)) / 2 + 2rem)) 4rem;
  color: var(--muted);
}
.foot::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--hairline); }
.foot nav { display: flex; flex-wrap: wrap; gap: var(--s2) 1.5rem; font-size: 0.85rem; margin-bottom: var(--s4); }
.foot nav a { color: var(--muted); text-decoration: none; }
.foot nav a:hover { color: var(--accent); text-decoration: underline; }
.foot p { margin: 0; font-size: 0.8rem; }

@media (max-width: 768px) {
  .top { padding: var(--s3) 1.2rem; gap: var(--s2) 1rem; }
  .nav, .session-bar { gap: var(--s2) 1rem; }
  .page { padding: 2.5rem 1.2rem 3.5rem; }
  .foot { padding: 2.5rem 1.2rem 3rem; }
}
@media (max-width: 520px) {
  .nav, .session-bar { margin-left: 0; width: 100%; }
  .page { padding: 2rem 1rem 3rem; }
  .aside { padding: var(--s4) var(--s4) var(--s4) 1.25rem; }
  .foot { padding: 2rem 1rem 2.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  button:hover, .action:hover, .columns > *:hover { transform: none; }
}
