/* Switchyard website: the landing page and the docs. Light and dark from the same tokens. */

:root {
  --bg: #fbfbfd;
  --bg-alt: #f3f2f8;
  --surface: #ffffff;
  --text: #16151d;
  --muted: #5e5b6b;
  --border: #e4e1ec;
  --brand: #6d4aff;
  --brand-strong: #5732f0;
  --brand-soft: #efeaff;
  --accent: #00a6c8;
  --ok: #138a4e;
  --code-bg: #17161d;
  --code-text: #e6e3ef;
  --shadow: 0 1px 2px rgba(20, 16, 40, 0.06), 0 12px 32px rgba(20, 16, 40, 0.08);
  --radius: 14px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #0f0e14;
  --bg-alt: #15141c;
  --surface: #1a1922;
  --text: #ecebf2;
  --muted: #a3a0b3;
  --border: #2b2936;
  --brand: #9d86ff;
  --brand-strong: #b4a2ff;
  --brand-soft: #241d42;
  --accent: #36c8e6;
  --ok: #4ad295;
  --code-bg: #0b0a10;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f0e14;
    --bg-alt: #15141c;
    --surface: #1a1922;
    --text: #ecebf2;
    --muted: #a3a0b3;
    --border: #2b2936;
    --brand: #9d86ff;
    --brand-strong: #b4a2ff;
    --brand-soft: #241d42;
    --accent: #36c8e6;
    --ok: #4ad295;
    --code-bg: #0b0a10;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
}

img {
  max-width: 100%;
  display: block;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
}

.wrap {
  width: min(1180px, 100% - 32px);
  margin-inline: auto;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* Header and footer */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff;
}

.logo.small .logo-mark {
  width: 24px;
  height: 24px;
  border-radius: 7px;
}

.header-nav {
  display: flex;
  gap: 4px;
}

.header-nav a {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.header-nav a:hover,
.header-nav a[aria-current='page'] {
  background: var(--bg-alt);
  color: var(--text);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle .moon,
:root[data-theme='dark'] .theme-toggle .sun {
  display: none;
}

:root[data-theme='dark'] .theme-toggle .moon {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .sun {
    display: none;
  }

  :root:not([data-theme='light']) .theme-toggle .moon {
    display: block;
  }
}

.menu-toggle {
  display: none;
}

.site-footer {
  margin-top: 96px;
  padding: 32px 0;
  border-top: 1px solid var(--border);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}

.footer-row nav {
  display: flex;
  gap: 18px;
  margin-left: auto;
}

.footer-row nav a {
  color: var(--muted);
  text-decoration: none;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s, background 0.15s;
}

:root[data-theme='dark'] .button:not(.secondary) {
  color: #14102b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .button:not(.secondary) {
    color: #14102b;
  }
}

.button:hover {
  background: var(--brand-strong);
  transform: translateY(-1px);
}

.button.secondary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.button.secondary:hover {
  border-color: var(--brand);
}

.button-small {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
}

/* Landing page */

.hero {
  position: relative;
  overflow: hidden;
  padding: 88px 0 56px;
}

.hero::before {
  content: '';
  position: absolute;
  inset: -40% -10% auto;
  height: 720px;
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--brand) 22%, transparent), transparent),
    radial-gradient(closest-side at 70% 60%, color-mix(in srgb, var(--accent) 16%, transparent), transparent);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 820px;
  margin-inline: auto;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.eyebrow .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent);
}

.hero h1 {
  margin: 20px 0 16px;
  font-size: clamp(40px, 7vw, 72px);
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.gradient-text {
  background: linear-gradient(90deg, var(--brand), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  max-width: 640px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(17px, 2.2vw, 20px);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 28px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 14px;
}

.facts strong {
  color: var(--text);
}

.shot {
  position: relative;
  margin: 56px auto 0;
  /* The screenshot's own width, so it's never stretched */
  max-width: 802px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.shot img {
  width: 100%;
  height: auto;
}

.shot-bar {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.shot-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
}

section {
  padding: 72px 0 0;
}

.section-head {
  max-width: 680px;
  margin-bottom: 36px;
}

.section-head.center {
  margin-inline: auto;
  text-align: center;
}

.kicker {
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 {
  margin: 8px 0 12px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.feature {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s, transform 0.15s;
}

.feature:hover {
  border-color: color-mix(in srgb, var(--brand) 50%, var(--border));
  transform: translateY(-2px);
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
}

.feature h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.feature p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.split-section {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 48px;
  align-items: center;
}

.split-section > * {
  min-width: 0;
}

.split-section.code-first {
  grid-template-columns: 1.2fr 1fr;
}

.steps {
  display: grid;
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
}

.steps strong {
  display: block;
}

.steps p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.diagram {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.diagram svg {
  width: 100%;
  height: auto;
}

.diagram text {
  fill: var(--text);
  font: 600 13px Inter, sans-serif;
}

.diagram .sub {
  fill: var(--muted);
  font-weight: 400;
  font-size: 11px;
}

.diagram .box {
  fill: var(--bg-alt);
  stroke: var(--border);
}

.diagram .box.brand {
  fill: var(--brand-soft);
  stroke: color-mix(in srgb, var(--brand) 40%, transparent);
}

.diagram .flow {
  stroke: var(--brand);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 5 6;
  animation: flow 1.2s linear infinite;
}

@keyframes flow {
  to {
    stroke-dashoffset: -22;
  }
}

@media (prefers-reduced-motion: reduce) {
  .diagram .flow {
    animation: none;
  }

  html {
    scroll-behavior: auto;
  }
}

.code-tabs {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--code-bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tab-list {
  display: flex;
  gap: 2px;
  padding: 8px;
  border-bottom: 1px solid #2a2836;
  overflow-x: auto;
}

.tab-list button {
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #a3a0b3;
  font: 500 14px Inter, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}

.tab-list button[aria-selected='true'] {
  background: #2a2836;
  color: #fff;
}

.tab-panel {
  margin: 0;
  padding: 20px 22px;
  overflow-x: auto;
  color: var(--code-text);
  font: 13.5px/1.7 var(--mono);
}

.tab-panel[hidden] {
  display: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-value {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.stat-label {
  color: var(--muted);
  font-size: 14px;
}

.compare {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.compare table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.compare th,
.compare td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.compare tr:last-child td {
  border-bottom: 0;
}

.compare th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.compare td:nth-child(2) {
  font-weight: 600;
}

.yes {
  color: var(--ok);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.gallery figure {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.gallery img {
  width: 100%;
  height: auto;
  border-bottom: 1px solid var(--border);
}

.gallery figcaption {
  padding: 12px 16px;
  color: var(--muted);
  font-size: 14px;
}

.stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.stack div {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.stack strong {
  display: block;
}

.cta {
  padding: 56px 32px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--brand) 30%, transparent), transparent 60%),
    radial-gradient(circle at 90% 100%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 55%),
    var(--surface);
  border: 1px solid var(--border);
  text-align: center;
}

.cta p {
  max-width: 560px;
  margin: 0 auto;
  color: var(--muted);
}

/* Docs */

.docs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 200px;
  gap: 48px;
  padding-top: 32px;
}

.sidebar,
.toc {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

.side-group {
  margin-bottom: 20px;
}

.side-title {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar a,
.toc a {
  display: block;
  padding: 5px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.sidebar a:hover,
.toc a:hover {
  color: var(--text);
}

.sidebar a[aria-current='page'] {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.toc a {
  padding: 3px 0;
  font-size: 13px;
}

.prose {
  min-width: 0;
  max-width: 760px;
}

.prose h1 {
  margin: 0 0 20px;
  font-size: clamp(32px, 5vw, 44px);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.prose h2 {
  margin: 48px 0 12px;
  font-size: 26px;
}

.prose h3 {
  margin: 32px 0 8px;
  font-size: 19px;
}

.prose h2,
.prose h3,
.prose h4 {
  position: relative;
}

.prose .anchor {
  position: absolute;
  left: -0.9em;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
}

.prose h2:hover .anchor,
.prose h3:hover .anchor {
  opacity: 1;
}

.prose p,
.prose li {
  color: color-mix(in srgb, var(--text) 88%, var(--muted));
}

.prose li + li {
  margin-top: 4px;
}

.prose :not(pre) > code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}

.prose blockquote {
  margin: 20px 0;
  padding: 12px 18px;
  border-left: 3px solid var(--brand);
  border-radius: 0 10px 10px 0;
  background: var(--brand-soft);
}

.prose blockquote p {
  margin: 0;
}

.table-wrap {
  margin: 20px 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.prose th,
.prose td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--bg-alt);
  font-size: 13px;
}

.prose tr:last-child td {
  border-bottom: 0;
}

.code {
  position: relative;
  margin: 20px 0;
  border-radius: 12px;
  background: var(--code-bg);
  border: 1px solid #2a2836;
}

.code pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  color: var(--code-text);
  font: 13.5px/1.65 var(--mono);
}

.code-lang {
  position: absolute;
  top: 8px;
  right: 72px;
  color: #7d7a8c;
  font: 12px var(--mono);
}

.copy {
  position: absolute;
  top: 6px;
  right: 8px;
  padding: 3px 10px;
  border: 1px solid #3a3848;
  border-radius: 7px;
  background: #22202c;
  color: #cfcbe0;
  font: 500 12px Inter, sans-serif;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.code:hover .copy,
.copy:focus-visible {
  opacity: 1;
}

.tok-key {
  color: #b9a7ff;
}

.tok-str {
  color: #7fdb9c;
}

.tok-com {
  color: #7d7a8c;
  font-style: italic;
}

.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
}

.page-nav a {
  display: grid;
  flex: 1;
  gap: 2px;
  max-width: 50%;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.page-nav a:hover {
  border-color: var(--brand);
}

.page-nav .next {
  text-align: right;
  margin-left: auto;
}

.edit-link {
  margin-top: 24px;
}

/* Smaller screens */

@media (max-width: 1100px) {
  .docs-layout {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .header-nav {
    position: absolute;
    top: 64px;
    right: 0;
    left: 0;
    display: none;
    flex-direction: column;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
  }

  .header-nav.open {
    display: flex;
  }

  .menu-toggle {
    display: grid;
  }

  .header-row > .button-small {
    display: none;
  }

  .split-section,
  .split-section.code-first {
    grid-template-columns: 1fr;
  }

  .docs-layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding-top: 16px;
  }

  .sidebar {
    position: static;
    max-height: none;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
  }

  .side-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
  }

  .side-title {
    flex-basis: 100%;
  }

  .sidebar a {
    padding: 4px 10px;
    border: 1px solid var(--border);
  }

  .prose .anchor {
    display: none;
  }

  .page-nav {
    flex-direction: column;
  }

  .page-nav a {
    max-width: none;
  }

  .hero {
    padding-top: 56px;
  }

  section {
    padding-top: 56px;
  }
}
