:root {
  --bg: #F4F3F1;
  --surface: #FFFFFF;
  --surface-2: #F5F4F2;
  --surface-3: #EDECE9;
  --ink: #2C2C2B;
  --muted: #7D7A75;
  --faint: #A5A29C;
  --line: #E9E8E5;
  --line-2: #E0DFDB;
  --accent: #2783DE;
  --accent-soft: #E5F2FC;
  --red: #E56458;
  --red-soft: #FCE9E7;
  --good: #46A171;
  --r-xl: 32px;
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .035);
  --toolbar-surface: rgba(255, 255, 255, .80);
  --sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #141414;
  --surface: #1E1E1E;
  --surface-2: #252525;
  --surface-3: #2F2F2E;
  --ink: #FFFFFF;
  --muted: rgba(255, 255, 255, .65);
  --faint: rgba(255, 255, 255, .42);
  --line: rgba(255, 255, 255, .10);
  --line-2: rgba(255, 255, 255, .16);
  --accent: #5E9FE8;
  --accent-soft: rgba(94, 159, 232, .14);
  --red: #E97366;
  --red-soft: rgba(233, 115, 102, .14);
  --good: #72BC8F;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
  --toolbar-surface: rgba(30, 30, 30, .76);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  letter-spacing: -0.011em;
  transition: background .25s ease, color .25s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

header.top {
  position: sticky;
  top: 14px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 28px;
  padding: 12px 14px 12px 18px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--toolbar-surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}

/* the header floats above the page, so it carries the page background with it
   to keep the sliver of content above it from peeking through the gap */
header.top::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -15px;
  left: -24px;
  right: -24px;
  height: 15px;
  background: var(--bg);
  pointer-events: none;
}


.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--ink);
  color: var(--surface);
  display: grid;
  place-items: center;
}

[data-theme="dark"] .mark {
  background: #FFF;
  color: #141414;
}

.mark svg {
  width: 18px;
  height: 18px;
}

.wordmark {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.035em;
  margin: 0;
  line-height: 1.1;
}

.brand .sub {
  font-size: 13px;
  color: var(--faint);
  margin: 2px 0 0;
  text-transform: lowercase;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav {
  display: inline-flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
}

.nav-link {
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--muted);
  transition: .18s;
  font-weight: 500;
}

.nav-link:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.nav-link.active {
  background: var(--ink);
  color: var(--surface);
}

[data-theme="dark"] .nav-link.active {
  background: #FFF;
  color: #141414;
}

.icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: .18s;
}

.icon-btn:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

[data-theme="light"] .icon-btn .moon { display: block; }
[data-theme="light"] .icon-btn .sun { display: none; }
[data-theme="dark"] .icon-btn .moon { display: none; }
[data-theme="dark"] .icon-btn .sun { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

.lead {
  padding: 36px 36px;
  margin-bottom: 28px;
}

.lead .eyebrow {
  font-size: 12.5px;
  text-transform: lowercase;
  color: var(--faint);
  font-weight: 500;
}

.lead h2 {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.045em;
  margin: 12px 0 14px;
  line-height: 1.15;
  max-width: 28ch;
}

.lead p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0;
  max-width: 64ch;
}

/* Tab Navigation Bar */
.tab-bar-container {
  margin-bottom: 32px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-bar {
  display: inline-flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px;
  box-shadow: var(--shadow);
}

.tab-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all .2s cubic-bezier(.2, .8, .2, 1);
}

.tab-btn svg {
  width: 15px;
  height: 15px;
  opacity: .7;
}

.tab-btn:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.tab-btn.active {
  background: var(--ink);
  color: var(--surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

[data-theme="dark"] .tab-btn.active {
  background: #FFF;
  color: #141414;
}

.tab-btn.active svg {
  opacity: 1;
}

/* Tab Content Switching */
.tab-content {
  display: none;
  animation: fadeIn .3s cubic-bezier(.2, .8, .2, 1) both;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Accordion & Details Elements */
.accordion {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color .2s ease;
}

.accordion[open] {
  border-color: var(--line-2);
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-weight: 500;
  font-size: 15px;
  color: var(--ink);
}

.accordion-header::-webkit-details-marker {
  display: none;
}

.accordion-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.accordion-icon {
  font-size: 18px;
  color: var(--faint);
  transition: transform .25s ease;
  transform: rotate(0deg);
}

.accordion[open] .accordion-icon {
  transform: rotate(90deg);
}

.accordion-body {
  padding: 4px 20px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.accordion-body p {
  margin-top: 14px;
}

code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--surface-3);
  color: var(--ink);
  padding: 2px 7px;
  border-radius: 6px;
}

.sec {
  margin-bottom: 36px;
}

.sec-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.sec-head .num {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  background: var(--surface-3);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.sec-head h3 {
  font-size: 19px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.03em;
  text-transform: lowercase;
}

.sec p {
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--muted);
  margin: 0 0 14px;
  max-width: 66ch;
}

.step-list {
  margin: 12px 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.8;
}

.step-list li {
  margin-bottom: 10px;
}

.step-list li b {
  color: var(--ink);
  font-weight: 500;
}

.code {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin: 12px 0 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.code .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--line);
}

.code .lang {
  font-size: 12px;
  text-transform: lowercase;
  color: var(--faint);
  font-weight: 500;
}

.code .copy {
  appearance: none;
  border: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: .18s;
  font-weight: 500;
}

.code .copy:hover {
  color: var(--ink);
  background: var(--surface-3);
}

.code .copy.done {
  color: var(--good);
  background: var(--surface-3);
}

.code pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--ink);
}

.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
  font-size: 13.5px;
}

.tbl th {
  padding: 0 16px 6px;
  text-align: left;
  font-size: 12px;
  color: var(--faint);
  font-weight: 500;
  text-transform: lowercase;
}

.tbl td {
  padding: 14px 16px;
  text-align: left;
  background: var(--surface-2);
  color: var(--muted);
  vertical-align: top;
  line-height: 1.6;
}

.tbl td:first-child {
  border-radius: var(--r-md) 0 0 var(--r-md);
  white-space: nowrap;
}

.tbl td:last-child {
  border-radius: 0 var(--r-md) var(--r-md) 0;
}

.tbl td.mono {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink);
}

.tbl tbody tr {
  transition: .18s;
}

.tbl tbody tr:hover td {
  background: var(--surface-3);
}

.table-card {
  padding: 18px 20px;
  margin-top: 14px;
}

.tag {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.tag.bad {
  color: var(--red);
  background: var(--red-soft);
}

.note {
  font-size: 13.5px;
  color: var(--muted);
  background: var(--surface-3);
  border-radius: var(--r-md);
  padding: 14px 18px;
  line-height: 1.7;
  margin: 14px 0 0;
  border-left: 3px solid var(--accent);
}

.scroll-x {
  overflow-x: auto;
}

.foot {
  margin-top: 48px;
  font-size: 12px;
  color: var(--faint);
  text-align: center;
  text-transform: lowercase;
}

.rise {
  animation: rise .5s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media(max-width:640px) {
  .wrap {
    padding: 20px 16px 60px;
  }

  .lead {
    padding: 24px 20px;
  }

  .lead h2 {
    font-size: 24px;
  }

  .tab-bar {
    width: 100%;
    overflow-x: auto;
  }
}
