:root {
  color-scheme: light;
  --ink: #17201c;
  --ink-soft: #34433d;
  --muted: #617069;
  --border: #ccd5d0;
  --surface: #ffffff;
  --soft: #f3f6f4;
  --green: #08775b;
  --green-dark: #005a43;
  --coral: #c85042;
  --blue: #2469a8;
  --yellow: #e4b64a;
  --danger: #b93131;
  --code: #121a17;
  --code-border: #33413b;
  --code-text: #e5eee9;
  --shadow: 0 16px 36px rgba(23, 32, 28, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.55;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input[type="checkbox"] {
  cursor: pointer;
}

button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

a {
  color: var(--green-dark);
}

code,
pre,
textarea {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-150%);
}

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

.site-header {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.brand > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 5px;
  background: var(--green);
  color: #fff;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.site-header nav,
footer nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.site-header nav a,
footer a {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.site-header nav a:hover,
footer a:hover {
  color: var(--green);
}

.hero {
  min-height: 386px;
  border-bottom: 1px solid var(--border);
  background-color: #fff;
  background-image: url("./assets/stable-stringify-structure.webp");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.hero-content {
  width: min(1240px, calc(100% - 64px));
  margin: 0 auto;
  padding: 52px 0 46px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2,
h3,
p,
td,
th,
dd {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 690px;
  margin: 0;
  font-size: 47px;
  line-height: 1.08;
}

h2 {
  margin: 0;
  font-size: 29px;
  line-height: 1.2;
}

h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.hero-copy {
  max-width: 560px;
  margin: 16px 0 22px;
  color: var(--ink-soft);
  font-size: 18px;
}

.install-row {
  display: inline-flex;
  max-width: 100%;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid #27352e;
  border-radius: 6px;
  background: var(--code);
  box-shadow: var(--shadow);
}

.install-row code {
  min-width: 0;
  padding: 11px 14px;
  overflow-x: auto;
  color: var(--code-text);
  white-space: nowrap;
}

.copy-button {
  min-width: 62px;
  border: 0;
  border-left: 1px solid #415149;
  background: #203128;
  color: #fff;
  font-size: 13px;
  font-weight: 750;
}

.copy-button:hover {
  background: var(--green-dark);
}

.release-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.section-inner {
  width: min(1120px, calc(100% - 64px));
  margin: 0 auto;
}

.section-inner.wide {
  width: min(1440px, calc(100% - 64px));
}

.playground-band {
  padding: 34px 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.tool-heading {
  margin-bottom: 18px;
}

.tool-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.secondary-button,
.primary-button,
.text-button {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
}

.icon-button {
  width: 40px;
  padding: 0;
  font-size: 21px;
}

.secondary-button,
.primary-button {
  padding: 0 16px;
}

.icon-button:hover,
.secondary-button:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.primary-button {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.primary-button:hover {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.control-bar {
  display: grid;
  grid-template-columns: minmax(176px, 1.25fr) minmax(230px, 1.5fr) repeat(3, minmax(118px, 0.8fr)) minmax(92px, 0.55fr);
  gap: 12px;
  align-items: end;
  padding: 14px 14px 12px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: var(--soft);
}

.control-bar label,
.limit-bar label,
.segmented-control {
  min-width: 0;
}

.control-bar label > span:first-child,
.limit-bar label > span,
.segmented-control legend {
  display: block;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.control-bar select,
.limit-bar input {
  width: 100%;
  height: 40px;
  border: 1px solid #aebbb4;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented-control legend {
  grid-column: 1 / -1;
}

.segmented-control button {
  height: 40px;
  border: 1px solid #aebbb4;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.segmented-control button:first-of-type {
  border-radius: 5px 0 0 5px;
}

.segmented-control button:not(:first-of-type) {
  border-left: 0;
}

.segmented-control button:last-of-type {
  border-radius: 0 5px 5px 0;
}

.segmented-control button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.toggle-line {
  display: flex;
  height: 40px;
  align-items: center;
  gap: 8px;
}

.toggle-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.toggle-line span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.limit-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 180px)) 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 0 14px 14px;
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  background: var(--soft);
}

.limit-bar .primary-button {
  grid-column: 5;
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.editor-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--code-border);
  border-radius: 6px;
  background: var(--code);
}

.editor-panel header {
  display: flex;
  height: 42px;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid var(--code-border);
  color: var(--code-text);
}

.editor-panel header h3 {
  font-size: 13px;
}

.editor-panel header > span {
  color: #9caf9f;
  font-size: 11px;
  font-weight: 700;
}

.editor-panel textarea,
.editor-panel pre {
  width: 100%;
  height: 326px;
  margin: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: var(--code);
  color: var(--code-text);
  font-size: 13px;
  line-height: 1.6;
  tab-size: 2;
}

.editor-panel textarea {
  display: block;
  resize: vertical;
  padding: 14px;
}

.editor-panel textarea:focus,
.editor-panel pre:focus {
  box-shadow: inset 0 0 0 2px var(--yellow);
}

.editor-panel pre {
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
}

.text-button {
  min-height: 28px;
  padding: 0 10px;
  border-color: #46564e;
  background: #1b2721;
  color: #dce7e1;
  font-size: 11px;
}

.text-button:hover {
  border-color: var(--yellow);
  color: #fff;
}

.status-bar {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 9px;
  padding: 7px 2px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.status-indicator {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
}

.status-indicator.error {
  background: var(--danger);
}

.status-separator {
  width: 1px;
  height: 14px;
  background: var(--border);
}

.status-spacer {
  flex: 1;
}

.content-band {
  padding: 64px 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.content-band.muted {
  background: var(--soft);
}

.content-band.contrast {
  background: var(--ink);
  color: #fff;
}

.content-band.contrast .eyebrow {
  color: #79d6bb;
}

.content-grid,
.proof-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 72px;
  align-items: start;
}

.content-grid p:not(.eyebrow) {
  max-width: 520px;
  color: var(--muted);
  font-size: 17px;
}

.code-surface {
  overflow: hidden;
  border-radius: 6px;
  background: var(--code);
  box-shadow: var(--shadow);
}

.code-surface pre {
  margin: 0;
  overflow-x: auto;
  padding: 18px 20px;
  color: var(--code-text);
  font-size: 13px;
}

.code-surface pre + pre {
  border-top: 1px solid var(--code-border);
}

.contract-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid #48534e;
  border-left: 1px solid #48534e;
}

.contract-grid article {
  min-width: 0;
  padding: 24px;
  border-right: 1px solid #48534e;
  border-bottom: 1px solid #48534e;
}

.contract-grid h3 {
  margin-top: 18px;
  font-size: 21px;
}

.contract-grid p {
  min-height: 76px;
  color: #c5d0ca;
  font-size: 14px;
}

.contract-grid code {
  color: #fff;
  font-size: 12px;
}

.contract-index {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 5px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 850;
}

.contract-index.coral {
  background: var(--coral);
}

.contract-index.blue {
  background: var(--blue);
}

.inline-link {
  font-weight: 750;
}

.api-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

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

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

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

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

.proof-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.proof-list div {
  min-width: 0;
  padding: 20px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.proof-list dt {
  color: var(--green-dark);
  font-size: 26px;
  font-weight: 850;
}

.proof-list dd {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

footer {
  display: flex;
  min-height: 104px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  background: var(--ink);
  color: #fff;
}

footer > div {
  display: grid;
  gap: 4px;
}

footer span {
  color: #b9c5be;
  font-size: 12px;
}

footer a {
  color: #e5ede8;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
pre:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

@media (max-width: 1120px) {
  .control-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .preset-control,
  .mode-control {
    grid-column: span 2;
  }

  .limit-bar {
    grid-template-columns: repeat(3, 1fr) auto;
  }

  .limit-bar .primary-button {
    grid-column: 4;
  }
}

@media (max-width: 760px) {
  .site-header {
    min-height: 58px;
    padding: 0 18px;
  }

  .site-header nav {
    gap: 13px;
  }

  .site-header nav a:first-child {
    display: none;
  }

  .brand > span:last-child {
    max-width: 180px;
  }

  .hero {
    min-height: 548px;
    background-position: 66% bottom;
    background-size: auto 58%;
  }

  .hero-content,
  .section-inner,
  .section-inner.wide {
    width: min(100% - 36px, 680px);
  }

  .hero-content {
    padding: 34px 0 30px;
  }

  h1 {
    font-size: 35px;
  }

  h2 {
    font-size: 25px;
  }

  .hero-copy {
    max-width: 480px;
    font-size: 16px;
  }

  .playground-band {
    padding-top: 28px;
  }

  .section-heading,
  .content-grid,
  .proof-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .section-heading {
    display: grid;
    align-items: start;
  }

  .tool-heading {
    grid-template-columns: 1fr auto;
  }

  .control-bar {
    grid-template-columns: 1fr 1fr;
  }

  .preset-control,
  .mode-control {
    grid-column: 1 / -1;
  }

  .limit-bar {
    grid-template-columns: 1fr 1fr;
  }

  .limit-bar label:last-of-type {
    grid-column: 1 / -1;
  }

  .limit-bar .primary-button {
    grid-column: 1 / -1;
  }

  .editor-grid,
  .contract-grid {
    grid-template-columns: 1fr;
  }

  .editor-panel textarea,
  .editor-panel pre {
    height: 280px;
  }

  .status-spacer,
  #mode-status {
    display: none;
  }

  .status-bar {
    flex-wrap: wrap;
  }

  .content-band {
    padding: 48px 0;
  }

  .contract-grid p {
    min-height: 0;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 24px 18px;
  }
}

@media (max-width: 460px) {
  .brand > span:last-child {
    max-width: 134px;
    font-size: 12px;
  }

  .site-header nav a {
    font-size: 12px;
  }

  .hero {
    min-height: 560px;
    background-position: 68% bottom;
  }

  h1 {
    font-size: 31px;
  }

  .install-row {
    width: 100%;
  }

  .install-row code {
    font-size: 11px;
  }

  .control-bar,
  .limit-bar {
    grid-template-columns: 1fr;
  }

  .control-bar > *,
  .limit-bar > *,
  .preset-control,
  .mode-control,
  .limit-bar label:last-of-type,
  .limit-bar .primary-button {
    grid-column: 1;
  }

  .mode-control button {
    font-size: 12px;
  }

  .tool-heading {
    grid-template-columns: 1fr;
  }

  .proof-list {
    grid-template-columns: 1fr;
  }
}

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