/* Tokens follow packages/ui/src/app.css: a cool slate ramp on hue 285 and the
   brand vermilion, which only the A of the mark and wordmark carries. */
:root {
  --bg: oklch(0.985 0.002 285);
  --fg: oklch(0.21 0.006 285);
  --muted: oklch(0.5 0.012 285);
  --card: oklch(1 0 0);
  --subtle: oklch(0.96 0.004 285);
  --border: oklch(0.91 0.005 285);
  --link: oklch(0.5 0.15 250);
  --brand: #ff3b14;
  --warn-bg: oklch(0.97 0.04 75);
  --warn-border: oklch(0.85 0.1 75);
  --code-bg: oklch(0.21 0.006 285);
  --code-fg: oklch(0.93 0.004 285);
  --code-comment: oklch(0.65 0.015 285);
  --code-key: oklch(0.78 0.12 300);
  --code-str: oklch(0.8 0.12 150);
  --code-num: oklch(0.8 0.12 65);
  --d1: oklch(0.5 0.17 272);
  --d2: oklch(0.55 0.13 175);
  --d3: oklch(0.55 0.15 50);
  --radius: 10px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: oklch(0.21 0.006 285);
    --fg: oklch(0.96 0.003 285);
    --muted: oklch(0.72 0.012 285);
    --card: oklch(0.25 0.008 285);
    --subtle: oklch(0.27 0.008 285);
    --border: oklch(0.34 0.01 285);
    --link: oklch(0.75 0.12 250);
    --warn-bg: oklch(0.3 0.05 75);
    --warn-border: oklch(0.5 0.09 75);
    --code-bg: oklch(0.17 0.006 285);
  }
}

:root[data-theme='dark'] {
  --bg: oklch(0.21 0.006 285);
  --fg: oklch(0.96 0.003 285);
  --muted: oklch(0.72 0.012 285);
  --card: oklch(0.25 0.008 285);
  --subtle: oklch(0.27 0.008 285);
  --border: oklch(0.34 0.01 285);
  --link: oklch(0.75 0.12 250);
  --warn-bg: oklch(0.3 0.05 75);
  --warn-border: oklch(0.5 0.09 75);
  --code-bg: oklch(0.17 0.006 285);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: var(--link);
  text-underline-offset: 2px;
}

code,
pre {
  font-family: var(--mono);
  font-size: 0.875em;
}

:not(pre) > code {
  background: var(--subtle);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.05em 0.35em;
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.top {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

body.doc .top-inner {
  max-width: 1240px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.wordmark svg {
  width: 24px;
  height: 24px;
}

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

.top-nav {
  display: flex;
  gap: 20px;
}

.top-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
}

.top-nav a:hover {
  color: var(--fg);
}

/* Landing page */
.hero {
  border-bottom: 1px solid var(--border);
  padding: 72px 0 64px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
}

.eyebrow {
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hero h1 {
  font-size: clamp(34px, 5vw, 52px);
  margin: 0 0 20px;
  letter-spacing: -0.035em;
}

.lede {
  font-size: 18px;
  color: var(--muted);
  margin: 0 0 28px;
  max-width: 38em;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
}

.btn:hover {
  background: var(--subtle);
}

.btn.primary {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}

.btn.primary:hover {
  opacity: 0.9;
}

.notice {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  margin: 0;
  max-width: 38em;
}

/* Side panel sketch on the hero */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 50px -20px oklch(0.21 0.006 285 / 0.25);
  max-width: 340px;
  width: 100%;
  justify-self: end;
  overflow: hidden;
  font-size: 14px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.panel-mark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.panel-mark svg {
  width: 20px;
  height: 20px;
}

.pill {
  background: var(--subtle);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
}

.panel-body {
  padding: 4px 12px 14px;
}

.panel-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin: 12px 0 6px;
}

.acct,
.site {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
}

.dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: none;
}

.d1 {
  background: var(--d1);
}
.d2 {
  background: var(--d2);
}
.d3 {
  background: var(--d3);
}

.acct-name {
  flex: 1;
  font-weight: 500;
}

.acct-bal {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.site {
  justify-content: space-between;
}

.revoke {
  color: var(--muted);
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 8px;
}

main > section.wrap {
  padding-top: 56px;
  padding-bottom: 8px;
}

main > section h2 {
  font-size: 28px;
  margin: 0 0 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.grid article {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.grid h3 {
  font-size: 17px;
  margin: 0 0 8px;
}

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

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  align-items: center;
}

.routes {
  padding-left: 20px;
}

.routes li {
  margin-bottom: 8px;
}

pre.code,
.prose pre {
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  line-height: 1.55;
  margin: 0;
}

pre.code .c {
  color: var(--code-comment);
}
pre.code .k {
  color: var(--code-key);
}
pre.code .s {
  color: var(--code-str);
}

.table-wrap {
  overflow-x: auto;
}

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 {
  font-weight: 600;
  background: var(--subtle);
}

.origin {
  padding-bottom: 64px !important;
}

.origin p {
  max-width: 44em;
}

/* Documentation pages */
.doc-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 48px;
  width: 100%;
  flex: 1;
}

.doc-nav {
  position: sticky;
  top: 56px;
  align-self: start;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 32px 0;
  font-size: 15px;
}

.doc-nav summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  pointer-events: none;
}

.doc-nav summary::-webkit-details-marker {
  display: none;
}

.nav-section {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 20px 0 6px;
}

.doc-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.doc-nav li a {
  display: block;
  padding: 5px 10px;
  margin-left: -10px;
  border-radius: 6px;
  color: var(--fg);
  text-decoration: none;
}

.doc-nav li a:hover {
  background: var(--subtle);
}

.doc-nav li a[aria-current='page'] {
  background: var(--subtle);
  font-weight: 600;
}

.prose {
  padding: 32px 0 64px;
  max-width: 760px;
  min-width: 0;
  overflow-wrap: break-word;
}

.prose h1 {
  font-size: 36px;
  margin: 0 0 24px;
}

.prose h2 {
  font-size: 24px;
  margin: 44px 0 12px;
  padding-top: 8px;
}

.prose h3 {
  font-size: 19px;
  margin: 32px 0 10px;
  overflow-wrap: anywhere;
}

.prose h2,
.prose h3 {
  scroll-margin-top: 72px;
}

.prose pre {
  margin: 16px 0;
  font-size: 14px;
}

.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}

.prose blockquote {
  margin: 20px 0;
  padding: 12px 16px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 8px;
}

.prose blockquote p {
  margin: 0;
}

.prose blockquote p + p {
  margin-top: 8px;
}

.prose table {
  display: block;
  overflow-x: auto;
  margin: 16px 0;
}

.prose img {
  max-width: 100%;
}

.prose li {
  margin-bottom: 4px;
}

/* Rouge syntax colours, on the dark code ground in both themes */
.highlight .c,
.highlight .c1,
.highlight .cm,
.highlight .cs,
.highlight .cp {
  color: var(--code-comment);
}
.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kr,
.highlight .kt,
.highlight .kc,
.highlight .o,
.highlight .ow {
  color: var(--code-key);
}
.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sb,
.highlight .se,
.highlight .sr,
.highlight .sx,
.highlight .na {
  color: var(--code-str);
}
.highlight .m,
.highlight .mi,
.highlight .mf,
.highlight .mh,
.highlight .kc {
  color: var(--code-num);
}
.highlight .nf,
.highlight .fm {
  color: oklch(0.8 0.1 230);
}

/* Footer */
.foot {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

.foot-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 32px;
}

.foot p {
  margin: 4px 0;
}

.foot a {
  color: inherit;
}

@media (max-width: 860px) {
  .hero {
    padding: 48px 0 40px;
  }
  .hero-grid,
  .split {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }
  .panel {
    justify-self: start;
  }
  .grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .doc-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .doc-nav {
    position: static;
    max-height: none;
    padding: 16px 0 0;
    border-bottom: 1px solid var(--border);
  }
  .doc-nav summary {
    pointer-events: auto;
    padding-bottom: 12px;
  }
  .doc-nav details[open] summary {
    padding-bottom: 0;
  }
  .doc-nav details[open] {
    padding-bottom: 16px;
  }
  .prose {
    padding-top: 24px;
  }
  .prose h1 {
    font-size: 30px;
  }
}

@media (max-width: 520px) {
  .top-nav {
    gap: 14px;
  }
}

@media (min-width: 861px) and (max-width: 1000px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
