/* Pier launch site. Same tokens as the panel (web/src/styles/tokens.css):
   dark by default, a single "tide" accent, state colors kept for state. */
:root {
  color-scheme: dark;
  --bg: #0b1016;
  --surface: #121922;
  --surface-raised: #1a2330;
  --surface-sunken: #080c11;
  --border: #263243;
  --border-strong: #3a4a61;
  --text: #e6edf5;
  --text-muted: #9aa8bc;
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-soft: rgba(45, 212, 191, 0.14);
  --on-accent: #04201c;
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --focus-ring: 0 0 0 3px rgba(45, 212, 191, 0.45);
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --content: 1120px;
  --topbar: 60px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-raised: #eef1f6;
    --surface-sunken: #e7ebf1;
    --border: #d5dbe5;
    --border-strong: #aeb8c8;
    --text: #101826;
    --text-muted: #4b5a70;
    --accent: #0f766e;
    --accent-hover: #115e59;
    --accent-soft: rgba(15, 118, 110, 0.1);
    --on-accent: #ffffff;
    --warning: #8a5200;
    --warning-soft: rgba(138, 82, 0, 0.08);
    --focus-ring: 0 0 0 3px rgba(15, 118, 110, 0.35);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-raised: #eef1f6;
  --surface-sunken: #e7ebf1;
  --border: #d5dbe5;
  --border-strong: #aeb8c8;
  --text: #101826;
  --text-muted: #4b5a70;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-soft: rgba(15, 118, 110, 0.1);
  --on-accent: #ffffff;
  --warning: #8a5200;
  --warning-soft: rgba(138, 82, 0, 0.08);
  --focus-ring: 0 0 0 3px rgba(15, 118, 110, 0.35);
}

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

html { scroll-padding-top: calc(var(--topbar) + 16px); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font-sans);
  overflow-x: hidden;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

code, pre { font-family: var(--font-mono); font-size: 0.9em; }
:not(pre) > code {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.35em;
  overflow-wrap: anywhere;
}

.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; }
.skip-link:focus { left: 16px; background: var(--surface); padding: 8px 12px; }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1360px;
  height: 100%;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 18px; text-decoration: none; }
.brand:hover { color: var(--text); }
.version-badge {
  font: 12px/1 var(--font-mono);
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 5px 8px;
}
.topnav { margin-left: auto; display: flex; gap: 4px; }
.topnav a { color: var(--text-muted); text-decoration: none; padding: 8px 12px; border-radius: var(--radius); font-size: 15px; }
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--text); background: var(--surface-raised); }
.theme-toggle, .menu-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  font-size: 18px;
  cursor: pointer;
}
.menu-toggle { display: none; }
.language-code { display: none; }

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.button:hover { background: var(--surface-raised); color: var(--text); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }

/* Code blocks */
.code-block {
  position: relative;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 16px 0 20px;
}
.code-block pre { margin: 0; padding: 36px 16px 16px; overflow-x: auto; line-height: 1.55; }
.code-lang {
  position: absolute;
  top: 8px;
  left: 14px;
  font: 12px/1 var(--font-mono);
  color: var(--text-muted);
  text-transform: lowercase;
}
.copy {
  position: absolute;
  top: 6px;
  right: 6px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font: 12px var(--font-sans);
  cursor: pointer;
}
.copy:hover { color: var(--text); }
.copy.copied { color: var(--accent); border-color: var(--accent); }

/* Home */
.home { max-width: var(--content); margin: 0 auto; padding: 0 16px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
  padding: 72px 0 56px;
}
.eyebrow { color: var(--accent); font: 13px/1 var(--font-mono); letter-spacing: 0.02em; margin: 0 0 16px; }
.hero h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 20px; }
.hero-lead { font-size: 18px; color: var(--text-muted); margin: 0 0 28px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-install {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.install-title { margin: 0; font-weight: 600; }
.install-note { margin: 0; font-size: 14px; color: var(--text-muted); }
.section { padding: 48px 0; border-top: 1px solid var(--border); }
.section h2 { font-size: 28px; letter-spacing: -0.01em; margin: 0 0 24px; }
.section.narrow { max-width: 680px; padding-top: 96px; border-top: 0; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; }
.steps h3 { margin: 2px 0 4px; font-size: 17px; }
.steps p { margin: 0; color: var(--text-muted); }
.step-number {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--accent); color: var(--text); }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 0; color: var(--text-muted); font-size: 15px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.split p { color: var(--text-muted); }
.beta { background: var(--warning-soft); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; margin: 24px 0 64px; }
.beta h2 { font-size: 22px; margin-bottom: 12px; }
.beta p { margin: 0 0 8px; }

/* Docs */
.docs-layout {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 200px;
  gap: 40px;
}
.docs-nav, .toc {
  position: sticky;
  top: var(--topbar);
  align-self: start;
  max-height: calc(100vh - var(--topbar));
  overflow-y: auto;
  padding: 28px 0;
}
.nav-title { margin: 0 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.nav-group { margin-bottom: 22px; }
.docs-nav ul, .toc ul { list-style: none; margin: 0; padding: 0; }
.docs-nav a {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 15px;
}
.docs-nav a:hover { color: var(--text); background: var(--surface-raised); }
.docs-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.toc a { display: block; padding: 4px 0; color: var(--text-muted); text-decoration: none; font-size: 14px; line-height: 1.4; }
.toc a:hover { color: var(--text); }

.doc { padding: 32px 0 64px; min-width: 0; }
.doc article { max-width: 760px; }
.doc h1 { font-size: 36px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 8px; }
.doc .lead { font-size: 18px; color: var(--text-muted); margin: 0 0 32px; }
.doc h2 { font-size: 24px; margin: 44px 0 12px; padding-top: 8px; border-top: 1px solid var(--border); }
.doc h3 { font-size: 19px; margin: 28px 0 8px; }
.doc h2, .doc h3 { position: relative; }
.anchor { position: absolute; left: -22px; color: var(--text-muted); opacity: 0; text-decoration: none; font-weight: 400; }
.doc h2:hover .anchor, .doc h3:hover .anchor { opacity: 1; }
.doc ul, .doc ol { padding-left: 24px; }
.doc li { margin: 4px 0; }
.doc blockquote {
  margin: 20px 0;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.doc blockquote p { margin: 4px 0; }
.table-wrap { overflow-x: auto; margin: 16px 0 20px; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface); font-weight: 600; }
tr:last-child td { border-bottom: 0; }

.translation-banner {
  margin: 0 0 28px;
  padding: 12px 16px;
  background: var(--warning-soft);
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  color: var(--text);
}
.not-found > div + div { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--border); }

.pager { display: flex; justify-content: space-between; gap: 16px; max-width: 760px; margin-top: 48px; }
.pager a {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
}
.pager a:hover { border-color: var(--accent); }
.pager span { display: block; font-size: 13px; font-weight: 400; color: var(--text-muted); }
.pager-next { text-align: right; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); }
.footer-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 14px;
}
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-inner a { color: var(--text-muted); text-decoration: none; }
.footer-inner a:hover { color: var(--text); }

/* Responsive */
@media (max-width: 1180px) {
  .docs-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 900px) {
  .hero, .split { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .hero { padding: 48px 0 40px; }
  .steps, .cards { grid-template-columns: minmax(0, 1fr); }
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .menu-toggle { display: inline-block; }
  body:not(.has-docs) .menu-toggle { display: none; }
.language-code { display: none; }
  .docs-nav {
    display: none;
    position: fixed;
    inset: var(--topbar) 0 0 0;
    max-height: none;
    background: var(--bg);
    padding: 20px 16px;
    z-index: 40;
  }
  .docs-nav.open { display: block; }
  .anchor { display: none; }
}

@media (max-width: 560px) {
  .topnav a:not(:first-child):not(.language-switch) { display: none; }
  .topnav a { padding: 8px 10px; }
  .language-name { display: none; }
  .language-code { display: inline; }
  .version-badge { display: none; }
  .doc h1 { font-size: 30px; }
  .pager { flex-direction: column; }
  .pager-next { text-align: left; }
}

@media (max-width: 400px) {
  .topbar-inner { gap: 8px; }
  .brand span { display: none; }
  .topnav a { padding: 8px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
