:root {
  color-scheme: light;
  --background: #f8f8fb;
  --surface: #ffffff;
  --text: #20212a;
  --muted: #626573;
  --border: #dedfe7;
  --accent: #6750a4;
  --accent-soft: #f0ebff;
  --code-background: #20212a;
  --code-text: #f7f7fa;
  --inline-code: #f0eef6;
  --table-heading: #f1f1f6;
  --table-stripe: #fafafd;
  --table-hover: #f5f1ff;
  --content-width: 920px;
  --site-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  padding: 0.6rem 0.8rem;
  border-radius: 0.4rem;
  background: var(--text);
  color: var(--surface);
  transform: translateY(-160%);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(80px, 1fr);
  align-items: center;
  gap: 1.5rem;
  width: min(calc(100% - 2rem), var(--site-width));
  min-height: 4rem;
  margin: 0 auto;
}

.brand {
  color: var(--text);
  font-weight: 740;
  text-decoration: none;
}

.header-inner nav {
  display: flex;
  gap: 0.2rem;
}

.header-inner nav a {
  border-radius: 0.4rem;
  color: var(--muted);
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
  text-decoration: none;
}

.header-inner nav a:hover,
.header-inner nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.github-link {
  justify-self: end;
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.content {
  width: min(calc(100% - 2rem), var(--content-width));
  margin: 0 auto;
  padding-bottom: 4rem;
}

.content.wide {
  --content-width: 1040px;
}

.hero,
.page-header {
  padding: 5rem 0 3.5rem;
}

.hero p:last-child,
.page-header p:last-child {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.08rem;
}

section {
  padding: 2.8rem 0;
  border-top: 1px solid var(--border);
}

h1,
h2,
h3 {
  line-height: 1.25;
}

h1 {
  max-width: 850px;
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 4.8rem);
  letter-spacing: -0.055em;
}

h2 {
  margin: 0 0 1.3rem;
  font-size: clamp(1.65rem, 4vw, 2.3rem);
  letter-spacing: -0.03em;
}

h3 {
  margin: 0;
  font-size: 1.08rem;
}

p {
  max-width: 780px;
}

code {
  border-radius: 0.25rem;
  background: var(--inline-code);
  padding: 0.1em 0.3em;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
}

pre {
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  border: 1px solid #32333d;
  border-radius: 0.65rem;
  background: var(--code-background);
  padding: 1rem 1.1rem;
  color: var(--code-text);
  line-height: 1.55;
}

pre code {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: 0.88rem;
}

.syntax-key {
  color: #8bd5ff;
}

.syntax-string {
  color: #b8e994;
}

.syntax-literal {
  color: #ffca80;
}

.syntax-expression {
  color: #d7b5ff;
}

.syntax-comment {
  color: #9699a8;
  font-style: italic;
}

.syntax-punctuation {
  color: #c8cad4;
}

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

.card {
  display: block;
  min-height: 145px;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--surface);
  padding: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.card:hover {
  border-color: var(--accent);
}

.card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(32, 33, 42, 0.04);
  scrollbar-color: #b9b3c8 transparent;
  scrollbar-width: thin;
}

.table-wrap::-webkit-scrollbar {
  height: 0.55rem;
}

.table-wrap::-webkit-scrollbar-thumb {
  border: 0.15rem solid transparent;
  border-radius: 1rem;
  background: #b9b3c8;
  background-clip: padding-box;
}

.table-wrap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

table {
  width: 100%;
  border-collapse: collapse;
  line-height: 1.45;
  text-align: left;
}

th,
td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

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

th {
  background: var(--table-heading);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 730;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

td {
  font-size: 0.92rem;
}

tbody tr:nth-child(even) {
  background: var(--table-stripe);
}

tbody tr:hover {
  background: var(--table-hover);
}

td:first-child {
  font-weight: 620;
}

.input-table {
  min-width: 680px;
}

.input-table th:first-child,
.input-table td:first-child {
  width: 36%;
}

.input-table th:nth-child(2),
.input-table td:nth-child(2) {
  width: 17%;
  white-space: nowrap;
}

.input-table td:first-child code {
  white-space: nowrap;
}

.support-table {
  min-width: 560px;
}

.compiler-table {
  min-width: 900px;
}

.support-table th:first-child,
.support-table td:first-child {
  width: 22%;
  white-space: nowrap;
}

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

.variable-groups > div {
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--surface);
  padding: 1rem;
}

.variable-panel {
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--surface);
  padding: 1rem;
}

.variable-groups p {
  margin-bottom: 0;
}

@media (max-width: 1100px) {
  .header-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding-top: 0.7rem;
  }

  .brand {
    flex: 1;
  }

  .header-inner nav {
    order: 3;
    overflow-x: auto;
    width: calc(100% + 2rem);
    margin: 0.65rem -1rem 0;
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--border);
  }

  .header-inner nav a {
    white-space: nowrap;
  }

  .github-link {
    margin-left: 1rem;
  }

  .hero,
  .page-header {
    padding: 3rem 0 2.5rem;
  }

  section {
    padding: 2.3rem 0;
  }
}

@media (max-width: 600px) {
  .cards,
  .variable-groups {
    grid-template-columns: 1fr;
  }

  .card {
    min-height: 0;
  }

  th,
  td {
    padding: 0.65rem 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
