/* Pier site — shared theme tokens + chrome.
   ────────────────────────────────────────────────────────────────────────
   The token ladder below is copied VERBATIM from the operator console's own
   design system (console/src/app.css) — bronze accent on a near-black IDE
   canvas, warm-paper light palette, same radii/spacing/shadow scale. The
   landing page and the docs viewer are meant to look like the console they
   front, so they share its tokens rather than inventing a second palette.
   Self-hosted: no remote fonts, no CDN — system font stacks only (this file
   is the ENTIRE cross-page dependency, vendored, no network fetch). */

*, *::before, *::after { box-sizing: border-box; }

:root {
  color-scheme: dark;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
  --font-disp: 'Trebuchet MS', var(--font-sans);

  --accent: #c89a56;
  --accent-hover: color-mix(in srgb, var(--accent) 85%, white 15%);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-contrast: var(--bg-base);
  --accent-fill: #c89a56;
  --accent-fill-contrast: #14100a;

  /* ═══ DARK — verbatim console ladder ═══ */
  --bg-base: #0c0c0c;
  --bg-surface: #111111;
  --bg-elevated: #1a1a1a;
  --bg-hover: #1e1e1e;
  --bg-active: #262626;
  --bg-selected: #1b1509;
  --bg-selected-border: #3a2e17;

  --border-subtle: #111111;
  --border-default: #1a1a1a;
  --border-strong: #222222;
  --border-emphasis: #333333;

  --text-primary: #e5e5e5;
  --text-secondary: #cccccc;
  --text-tertiary: #999999;
  --text-muted: #888888;
  --text-faint: #666666;
  --text-ghost: #555555;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.50), 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.60), 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.65), 0 8px 20px rgba(0, 0, 0, 0.40);

  --status-success: #2dd4bf;
  --status-warning: #f59e0b;
  --status-danger: #f43f5e;
  --status-success-soft: color-mix(in srgb, var(--status-success) 14%, transparent);
  --status-warning-soft: color-mix(in srgb, var(--status-warning) 14%, transparent);
  --status-danger-soft: color-mix(in srgb, var(--status-danger) 12%, transparent);

  --radius-xs: 4px; --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px; --radius-xl: 24px; --radius-full: 9999px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 50%, transparent);
  --nav-scrim: rgba(12, 12, 12, 0.86);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 120ms; --dur: 180ms; --dur-slow: 320ms;
  --max: 1220px;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg-base: #0c0c0c; --bg-surface: #111111; --bg-elevated: #1a1a1a; --bg-hover: #1e1e1e; --bg-active: #262626;
  --bg-selected: #1b1509; --bg-selected-border: #3a2e17;
  --border-subtle: #111111; --border-default: #1a1a1a; --border-strong: #222222; --border-emphasis: #333333;
  --text-primary: #e5e5e5; --text-secondary: #cccccc; --text-tertiary: #999999; --text-muted: #888888; --text-faint: #666666; --text-ghost: #555555;
  --status-success: #2dd4bf; --status-warning: #f59e0b; --status-danger: #f43f5e;
  --nav-scrim: rgba(12, 12, 12, 0.86);
  --accent: #c89a56;
  --accent-hover: color-mix(in srgb, var(--accent) 85%, white 15%);
}

/* ═══ LIGHT — warm-neutral paper, accent deepened for AA text contrast ═══ */
:root[data-theme='light'] {
  color-scheme: light;
  --accent: color-mix(in srgb, #c89a56 60%, black);
  --accent-hover: color-mix(in srgb, var(--accent) 84%, black 16%);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --bg-base: #fdfcfa; --bg-surface: #f5f2ec; --bg-elevated: #efebe3; --bg-hover: #e9e4da; --bg-active: #e2dccf;
  --bg-selected: #f3ecdc; --bg-selected-border: #dcc79a;
  --border-subtle: #f0ebe2; --border-default: #e6e0d5; --border-strong: #dad3c6; --border-emphasis: #c7bfae;
  --text-primary: #1c1a17; --text-secondary: #3a352e; --text-tertiary: #5b544a; --text-muted: #6d6559; --text-faint: #877e70; --text-ghost: #a49a89;
  --shadow-sm: 0 2px 8px rgba(28, 26, 23, 0.07), 0 1px 3px rgba(28, 26, 23, 0.05);
  --shadow-md: 0 8px 28px rgba(28, 26, 23, 0.10), 0 2px 8px rgba(28, 26, 23, 0.06);
  --shadow-lg: 0 20px 52px rgba(28, 26, 23, 0.12), 0 8px 18px rgba(28, 26, 23, 0.07);
  --status-success: #0d9488; --status-warning: #b45309; --status-danger: #e11d48;
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 32%, transparent);
  --nav-scrim: rgba(253, 252, 250, 0.86);
}

/* Pre-hydration system-light fallback (no FOUC), only until JS stamps data-theme. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --accent: color-mix(in srgb, #c89a56 60%, black);
    --accent-hover: color-mix(in srgb, var(--accent) 84%, black 16%);
    --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
    --bg-base: #fdfcfa; --bg-surface: #f5f2ec; --bg-elevated: #efebe3; --bg-hover: #e9e4da; --bg-active: #e2dccf;
    --bg-selected: #f3ecdc; --bg-selected-border: #dcc79a;
    --border-subtle: #f0ebe2; --border-default: #e6e0d5; --border-strong: #dad3c6; --border-emphasis: #c7bfae;
    --text-primary: #1c1a17; --text-secondary: #3a352e; --text-tertiary: #5b544a; --text-muted: #6d6559; --text-faint: #877e70; --text-ghost: #a49a89;
    --shadow-sm: 0 2px 8px rgba(28, 26, 23, 0.07), 0 1px 3px rgba(28, 26, 23, 0.05);
    --shadow-md: 0 8px 28px rgba(28, 26, 23, 0.10), 0 2px 8px rgba(28, 26, 23, 0.06);
    --shadow-lg: 0 20px 52px rgba(28, 26, 23, 0.12), 0 8px 18px rgba(28, 26, 23, 0.07);
    --status-success: #0d9488; --status-warning: #b45309; --status-danger: #e11d48;
    --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 32%, transparent);
    --nav-scrim: rgba(253, 252, 250, 0.86);
  }
}

html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg-base); color: var(--text-primary);
  font-family: var(--font-mono); font-size: 15px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.disp { font-family: var(--font-disp); font-weight: 700; letter-spacing: -0.02em; }
p, .prose { font-family: var(--font-sans); }

::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); color: var(--text-primary); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-emphasis); border-radius: 99px; }
* { scrollbar-width: thin; scrollbar-color: var(--border-emphasis) transparent; }

/* ── site header (shared shell, both pages) ─────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50; backdrop-filter: blur(10px);
  background: var(--nav-scrim); border-bottom: 1px solid var(--border-default);
}
.nav { display: flex; align-items: center; gap: 18px; height: 58px; }.brand {
  display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: .14em;
  padding-left: 16px; border-left: 1px solid var(--border-default); min-height: 44px;
}
.brand svg { color: var(--accent); height: 22px; width: auto; flex: none; }
.brand b { font-family: var(--font-disp); letter-spacing: .16em; }
.nav-spacer { flex: 1; }
.nav-links { display: flex; align-items: center; gap: 18px; font-size: 13px; color: var(--text-muted); }
.nav-links a { min-height: 44px; display: inline-flex; align-items: center; }
.nav-links a:hover { color: var(--text-primary); }
.btn {
  border: 1px solid var(--border-strong); padding: 9px 14px; font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-primary); transition: .15s; white-space: nowrap;
  min-height: 44px; display: inline-flex; align-items: center; border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}
.btn:hover { border-color: var(--accent); color: var(--accent-hover); background: var(--bg-hover); }
.btn-fill { background: var(--accent-fill); border-color: transparent; color: var(--accent-fill-contrast); font-weight: 600; }
.btn-fill:hover { background: color-mix(in srgb, var(--accent-fill) 88%, black); color: var(--accent-fill-contrast); }

/* theme toggle */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  min-width: 44px; min-height: 44px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-elevated);
  color: var(--text-secondary); cursor: pointer; transition: .15s; flex: none;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .moon { display: none; }
:root[data-theme='light'] .theme-toggle .sun { display: none; }
:root[data-theme='light'] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .theme-toggle .sun { display: none; }
  :root:not([data-theme]) .theme-toggle .moon { display: block; }
}

@media (max-width: 640px) { .brand b { display: none; } .nav-links a.hidem { display: none; } }
/* Below 400px the header CTA button plus back-link/brand/toggle no longer fit
   one unwrapped row; the CTA is never the only way to reach it (the hero and
   footer both repeat it), so it is the one thing that yields. */
@media (max-width: 400px) { .site-header .nav > a.btn { display: none; } }

/* ── site footer (shared shell, both pages) ─────────────────────────── */
.site-footer { border-top: 1px solid var(--border-default); margin-top: 20px; padding: 32px 0; color: var(--text-faint); font-size: 12px; }
.foot { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.foot a { color: var(--text-muted); min-height: 44px; display: inline-flex; align-items: center; }
.foot a:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
