:root {
  color-scheme: light;
  --canvas: #f7f9fc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --surface-accent: #eff6ff;
  --text: #172033;
  --text-soft: #46536a;
  --muted: #6b778c;
  --border: #dce3ec;
  --border-strong: #c6d0de;
  --brand: #1769e0;
  --brand-dark: #0b4db3;
  --brand-ink: #0a3c88;
  --success: #087557;
  --success-bg: #ecfdf5;
  --danger: #b42318;
  --danger-bg: #fff4f2;
  --warning: #8a4b08;
  --warning-bg: #fff9e8;
  --code: #e7edf7;
  --code-bg: #111a2b;
  --shadow: 0 12px 30px rgb(23 32 51 / 7%);
  --radius: 0.75rem;
  --header-height: 4.5rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1.5rem);
}

body {
  margin: 0;
  min-width: 20rem;
  background: var(--canvas);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand-dark);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

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

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  min-height: 2.75rem;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgb(23 105 224 / 14%);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

:focus-visible {
  outline: 3px solid #1769e0;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  transform: translateY(-160%);
  border-radius: 0.5rem;
  background: var(--text);
  color: #fff;
  padding: 0.625rem 0.875rem;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgb(198 208 222 / 82%);
  background: rgb(255 255 255 / 94%);
  padding: 0.75rem clamp(1rem, 4vw, 3rem);
  backdrop-filter: blur(14px);
}

.brand-lockup,
.brand,
.brand > span:last-child {
  display: flex;
  align-items: center;
}

.brand-lockup {
  min-width: 0;
  gap: 1rem;
}

.brand {
  flex: 0 0 auto;
  gap: 0.7rem;
  color: var(--text);
  line-height: 1.1;
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
}

.brand > span:last-child {
  align-items: flex-start;
  flex-direction: column;
}

.brand small {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  place-items: center;
  border-radius: 0.55rem;
  background: var(--brand);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  box-shadow: 0 7px 16px rgb(23 105 224 / 20%);
}

.compatibility-badge {
  overflow: hidden;
  border: 1px solid #bed4f5;
  border-radius: 999px;
  background: var(--surface-accent);
  color: var(--brand-ink);
  padding: 0.25rem 0.625rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-link {
  flex: 0 0 auto;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
}

.mobile-doc-controls {
  display: none;
}

.docs-layout {
  display: grid;
  grid-template-columns: minmax(13rem, 16rem) minmax(0, 48rem) minmax(9rem, 12rem);
  gap: clamp(1.5rem, 3vw, 3rem);
  width: min(100% - 2rem, 90rem);
  margin-inline: auto;
  padding-block: clamp(2rem, 5vw, 4.5rem) 5rem;
}

.primary-nav,
.page-outline {
  position: sticky;
  top: calc(var(--header-height) + 2rem);
  align-self: start;
  max-height: calc(100vh - var(--header-height) - 3rem);
  overflow-y: auto;
}

.primary-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-label {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.105em;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  min-height: 2.75rem;
  align-items: center;
  border-radius: 0.45rem;
  color: var(--text-soft);
  padding: 0.42rem 0.65rem;
  font-size: 0.875rem;
  font-weight: 560;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.nav-link.is-active {
  background: var(--surface-accent);
  color: var(--brand-dark);
  font-weight: 720;
}

.article {
  min-width: 0;
}

.doc-section {
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
  margin-bottom: clamp(4.25rem, 8vw, 7rem);
}

h1[id],
h2[id],
h3[id] {
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.doc-section:last-child {
  margin-bottom: 0;
}

.hero-section {
  padding-top: 0.3rem;
}

h1,
h2,
h3,
p,
ul,
dl {
  max-width: 68ch;
}

h1,
h2,
h3 {
  color: var(--text);
  font-weight: 750;
  letter-spacing: -0.024em;
  line-height: 1.18;
  text-wrap: balance;
}

h1 {
  max-width: 17ch;
  margin: 0.25rem 0 1.15rem;
  font-size: clamp(2.35rem, 5vw, 4.25rem);
}

h2 {
  margin: 0.2rem 0 1rem;
  font-size: clamp(1.75rem, 3vw, 2.45rem);
}

h3 {
  margin: 2.3rem 0 0.75rem;
  font-size: 1.12rem;
}

p {
  margin-block: 0.7rem 1.1rem;
  color: var(--text-soft);
}

.lead {
  max-width: 58ch;
  margin-bottom: 2rem;
  color: #344158;
  font-size: clamp(1.08rem, 2vw, 1.25rem);
}

.eyebrow {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 820;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

code {
  border-radius: 0.28rem;
  background: #eaf0f8;
  color: #1d375e;
  padding: 0.12em 0.3em;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

.quick-grid,
.feature-grid,
.security-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.quick-card,
.feature-grid article,
.security-grid article {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.15rem;
  box-shadow: 0 4px 15px rgb(23 32 51 / 4%);
}

.quick-card {
  display: flex;
  min-height: 13rem;
  align-items: flex-start;
  flex-direction: column;
}

.quick-card-accent {
  border-color: #c4d8f8;
  background: var(--surface-accent);
}

.quick-card h2,
.feature-grid h3,
.security-grid h3 {
  margin: 0.8rem 0 0.3rem;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.quick-card p,
.feature-grid p,
.security-grid p {
  margin: 0 0 0.8rem;
  font-size: 0.875rem;
  line-height: 1.55;
}

.quick-card .button,
.quick-card .inline-endpoint {
  margin-top: auto;
}

.card-icon {
  display: grid;
  width: 2.1rem;
  height: 2.1rem;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-subtle);
  color: var(--brand-dark);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.76rem;
  font-weight: 800;
}

.inline-endpoint {
  display: block;
  width: 100%;
  overflow: hidden;
  background: var(--surface-subtle);
  padding: 0.45rem;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button,
.copy-button {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 720;
  line-height: 1.2;
  text-decoration: none;
}

.button-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 14px rgb(23 105 224 / 18%);
}

.button-primary:hover {
  background: var(--brand-dark);
  color: #fff;
}

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

.button-secondary:hover,
.copy-button:hover {
  border-color: #9eb5d4;
  color: var(--brand-dark);
}

.button-quiet {
  background: transparent;
  color: var(--muted);
}

.quick-card > .copy-button {
  width: 100%;
  margin-top: 0.55rem;
}

.key-helper,
.balance-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.key-helper {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(18rem, 1.15fr);
  gap: 1.5rem;
  margin-top: 1.4rem;
  padding: 1.25rem;
}

.key-helper h2 {
  margin: 0.15rem 0 0.3rem;
  font-size: 1.15rem;
}

.key-helper p {
  margin: 0;
  font-size: 0.86rem;
}

.key-control label,
.balance-panel label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 720;
}

.key-control small {
  display: block;
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.input-row {
  display: flex;
  align-items: stretch;
  gap: 0.55rem;
}

.input-row:focus-within input {
  border-color: #79a7ea;
  box-shadow: 0 0 0 3px rgb(23 105 224 / 10%);
}

input,
select {
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text);
  padding: 0.55rem 0.75rem;
}

input {
  flex: 1 1 12rem;
}

input::placeholder {
  color: #8b96a8;
}

.callout,
.warning-callout {
  border-left: 3px solid var(--brand);
  border-radius: 0 0.5rem 0.5rem 0;
  background: var(--surface-accent);
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
}

.warning-callout {
  border-left-color: #d58417;
  background: var(--warning-bg);
  color: var(--warning);
}

.code-block {
  overflow: hidden;
  margin: 1rem 0 1.6rem;
  border: 1px solid #26344b;
  border-radius: 0.7rem;
  background: var(--code-bg);
  box-shadow: 0 10px 25px rgb(17 26 43 / 10%);
}

.code-header {
  display: flex;
  min-height: 2.8rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #2a3850;
  padding: 0.38rem 0.45rem 0.38rem 1rem;
  color: #9fadbf;
  font-size: 0.74rem;
  font-weight: 700;
}

.code-header .copy-button {
  min-height: 2.75rem;
  border-color: #3b4a61;
  background: #1b273a;
  color: #d9e2ef;
  padding-block: 0.35rem;
}

pre {
  overflow-x: auto;
  margin: 0;
  padding: 1rem;
  tab-size: 2;
}

pre code {
  background: transparent;
  color: var(--code);
  padding: 0;
  font-size: 0.82rem;
  line-height: 1.6;
  overflow-wrap: normal;
  white-space: pre;
}

.definition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1.4rem 0;
}

.definition-grid > div {
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--surface);
  padding: 0.85rem;
}

.definition-grid dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 780;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.definition-grid dd {
  margin: 0.4rem 0 0;
}

.balance-panel {
  padding: clamp(1.1rem, 4vw, 2rem);
}

.balance-result {
  display: flex;
  min-height: 6rem;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  margin-top: 1rem;
  border: 1px dashed var(--border-strong);
  border-radius: 0.65rem;
  background: var(--surface-subtle);
  color: var(--text-soft);
  padding: 1rem 1.25rem;
}

.balance-result.is-success {
  border-style: solid;
  border-color: #a7ddc7;
  background: var(--success-bg);
  color: var(--success);
}

.balance-result.is-error {
  border-style: solid;
  border-color: #f2b8b1;
  background: var(--danger-bg);
  color: var(--danger);
}

.balance-result-label {
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.balance-result-value {
  margin-top: 0.2rem;
  font-size: 2rem;
  line-height: 1.1;
}

.local-preview-note {
  margin-top: 1rem;
  border-radius: 0.55rem;
  background: #f4f1ff;
  color: #59428f;
  padding: 0.75rem 0.9rem;
  font-size: 0.78rem;
}

.feature-grid,
.security-grid {
  margin-top: 1.4rem;
}

.code-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 1rem;
  padding-left: 1.25rem;
}

.limitations-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.limitations-grid > div {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.25rem 1.15rem 1rem;
}

.limitations-grid ul {
  margin-bottom: 0;
  padding-left: 1.2rem;
  color: var(--text-soft);
}

.reference-link {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.45rem;
  border-bottom: 1px solid var(--brand);
  font-weight: 720;
  text-decoration: none;
}

.page-outline {
  border-left: 1px solid var(--border);
  color: var(--muted);
  padding-left: 1rem;
  font-size: 0.79rem;
}

.page-outline a {
  display: block;
  margin-block: 0.42rem;
  color: var(--muted);
  line-height: 1.35;
  text-decoration: none;
}

.page-outline a:hover {
  color: var(--brand-dark);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.5rem max(1rem, calc((100% - 90rem) / 2));
  color: var(--text-soft);
  font-size: 0.8rem;
}

.site-footer nav {
  display: flex;
  gap: 1rem;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}

@media (max-width: 66rem) {
  .docs-layout {
    grid-template-columns: minmax(11rem, 13rem) minmax(0, 48rem);
    justify-content: center;
  }

  .page-outline {
    display: none;
  }
}

@media (max-width: 48rem) {
  :root {
    --header-height: 4rem;
  }

  .site-header {
    padding-inline: 1rem;
  }

  .doc-section {
    scroll-margin-top: calc(var(--header-height) + 5rem);
  }

  h1[id],
  h2[id],
  h3[id] {
    scroll-margin-top: calc(var(--header-height) + 5rem);
  }

  .compatibility-badge,
  .header-link,
  .page-outline,
  .primary-nav {
    display: none;
  }

  .mobile-doc-controls {
    position: sticky;
    top: var(--header-height);
    z-index: 35;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.55rem;
    border-bottom: 1px solid var(--border);
    background: rgb(247 249 252 / 96%);
    padding: 0.65rem 1rem;
    backdrop-filter: blur(12px);
  }

  .section-select-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .mobile-doc-controls select {
    width: 100%;
    background: var(--surface);
    font-size: 0.82rem;
  }

  .primary-nav.is-mobile-open {
    position: fixed;
    top: calc(var(--header-height) + 4.1rem);
    right: 1rem;
    left: 1rem;
    z-index: 38;
    display: flex;
    max-height: calc(100vh - var(--header-height) - 5.5rem);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 0.8rem;
    box-shadow: var(--shadow);
  }

  .docs-layout {
    display: block;
    width: min(100% - 2rem, 48rem);
    padding-block: 2.25rem 4rem;
  }

  h1 {
    font-size: clamp(2.15rem, 11vw, 3rem);
  }

  .quick-grid,
  .feature-grid,
  .security-grid,
  .definition-grid,
  .limitations-grid,
  .code-list,
  .key-helper {
    grid-template-columns: minmax(0, 1fr);
  }

  .quick-card {
    min-height: 11rem;
  }

  .key-helper {
    gap: 1rem;
  }

  .input-row {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .input-row input {
    flex-basis: 100%;
  }

  .input-row .button {
    flex: 1 1 auto;
  }

  pre {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    padding-inline: 1rem;
  }
}

@media (max-width: 25rem) {
  .brand small {
    display: none;
  }

  .site-footer nav {
    flex-wrap: wrap;
  }
}

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