:root,
[data-theme="light"] {
  color-scheme: light;
  --background: #f4f4f4;
  --layer-1: #ffffff;
  --layer-2: #e0e0e0;
  --layer-3: #c6c6c6;
  --text: #161616;
  --text-muted: #525252;
  --border: #e0e0e0;
  --border-strong: #8d8d8d;
  --link: #0f62fe;
  --link-hover: #0043ce;
  --primary: #0f62fe;
  --primary-hover: #0353e9;
  --on-primary: #ffffff;
  --focus: #0f62fe;
  --danger: #da1e28;
  --success: #198038;
  --warning: #8a3800;
  --code: #f4f4f4;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --background: #161616;
    --layer-1: #262626;
    --layer-2: #393939;
    --layer-3: #525252;
    --text: #f4f4f4;
    --text-muted: #c6c6c6;
    --border: #393939;
    --border-strong: #6f6f6f;
    --link: #78a9ff;
    --link-hover: #a6c8ff;
    --primary: #0f62fe;
    --primary-hover: #0353e9;
    --on-primary: #ffffff;
    --focus: #78a9ff;
    --danger: #ff8389;
    --success: #42be65;
    --warning: #f1c21b;
    --code: #262626;
  }
}

[data-theme="dark"] {
  color-scheme: dark;
  --background: #161616;
  --layer-1: #262626;
  --layer-2: #393939;
  --layer-3: #525252;
  --text: #f4f4f4;
  --text-muted: #c6c6c6;
  --border: #393939;
  --border-strong: #6f6f6f;
  --link: #78a9ff;
  --link-hover: #a6c8ff;
  --primary: #0f62fe;
  --primary-hover: #0353e9;
  --on-primary: #ffffff;
  --focus: #78a9ff;
  --danger: #ff8389;
  --success: #42be65;
  --warning: #f1c21b;
  --code: #262626;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4rem;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 400 1rem/1.5 "IBM Plex Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1,
h2 {
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.025em;
}

h1 {
  max-width: 16ch;
  font-size: clamp(2.6rem, 7vw, 5.5rem);
}

h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

h4 {
  font-size: 0.875rem;
  font-weight: 600;
}

p {
  max-width: 68ch;
  color: var(--text-muted);
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

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

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

code,
pre,
.mono {
  font-family: "IBM Plex Mono", monospace;
}

.container {
  width: min(100% - 3rem, 88rem);
  margin-inline: auto;
}

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

.eyebrow {
  margin-bottom: 0.65rem;
  color: var(--link);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.section-head {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--layer-1);
  border-bottom: 1px solid var(--border);
}

.nav {
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.logo {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 600;
}

.logo:hover {
  color: var(--text);
  text-decoration: none;
}

.logo span {
  color: var(--link);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-links a {
  padding-block: 1rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.nav-links a:hover {
  color: var(--text);
}

.spacer {
  flex: 1;
}

.segmented {
  display: flex;
  border: 1px solid var(--border-strong);
}

.segmented button,
.segmented a {
  border: 0;
  border-right: 1px solid var(--border);
  padding: 0.4rem 0.55rem;
  background: var(--layer-1);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 1.1;
  text-decoration: none;
}

.segmented button:last-child,
.segmented a:last-child {
  border-right: 0;
}

.segmented button[aria-pressed="true"],
.segmented a[aria-current="page"] {
  background: var(--layer-2);
  color: var(--text);
}

.lang button,
.lang a {
  font-weight: 600;
}

.theme {
  margin-left: 0.25rem;
}

.hero {
  padding-block: clamp(3.5rem, 7vw, 6rem);
}

.hero .eyebrow {
  margin-bottom: 1rem;
}

.lede {
  margin-top: 1.5rem;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-block: 2rem;
}

.chip {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--layer-1);
  font-size: 0.8rem;
}

.chip + .chip {
  border-left: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.75rem 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  text-decoration: none;
}

.primary {
  background: var(--primary);
  color: var(--on-primary);
}

.primary:hover {
  background: var(--primary-hover);
  color: var(--on-primary);
}

.secondary {
  border-color: var(--link);
  background: transparent;
  color: var(--link);
}

.secondary:hover {
  background: var(--layer-2);
  color: var(--link-hover);
}

.tertiary {
  background: transparent;
  color: var(--link);
}

.tertiary:hover {
  background: var(--layer-2);
}

.grid {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

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

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

.panel {
  min-width: 0;
  padding: 1.5rem;
  background: var(--layer-1);
}

.feature .panel {
  min-height: 13rem;
}

.type-label {
  display: inline-block;
  margin-bottom: 0.75rem;
  color: var(--link);
  font: 500 0.75rem "IBM Plex Mono", monospace;
}

.panel p {
  margin-top: 0.55rem;
  font-size: 0.875rem;
}

.placeholder-box {
  min-height: 9rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px dashed var(--border-strong);
  padding: 1.5rem;
  background: var(--layer-1);
}

.case-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.case-picker button {
  flex: 1 1 9rem;
  border: 0;
  border-right: 1px solid var(--border);
  padding: 0.75rem;
  background: var(--layer-1);
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  font-size: 0.8rem;
}

.case-picker button:last-child {
  border-right: 0;
}

.case-picker button[aria-pressed="true"] {
  background: var(--layer-2);
  color: var(--text);
  box-shadow: inset 0 -3px var(--link);
}

.demo-state {
  min-height: 8rem;
  overflow-wrap: anywhere;
}

.demo-state p {
  margin-top: 0.75rem;
}

.raw-state {
  padding: 0.8rem;
  border-left: 2px solid var(--link);
  background: var(--code);
  color: var(--text);
  font: 0.75rem/1.6 "IBM Plex Mono", monospace;
}

.app-context {
  margin-bottom: 1rem;
}

.app-context,
.response-copy {
  font-size: 0.85rem;
}

.question-list {
  display: grid;
  gap: 1px;
  margin-top: 1.25rem;
  border: 1px solid var(--border);
  background: var(--border);
}

.question-config {
  min-width: 0;
  padding: 1rem;
  border: 0;
  background: var(--layer-1);
}

.question-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
}

.question-toggle input,
.criterion input {
  flex: 0 0 auto;
  margin-top: 0.25rem;
  accent-color: var(--primary);
}

.question-toggle strong {
  display: block;
  font-size: 0.875rem;
  line-height: 1.4;
}

.question-toggle .type-label {
  margin: 0.2rem 0 0 auto;
}

.criteria-caption {
  margin: 0.85rem 0 0.35rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.criteria-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.criterion {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.75rem;
  cursor: pointer;
}

.question-config[aria-disabled="true"] {
  opacity: 0.55;
}

.response-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.response-head .type-label {
  margin: 0;
}

.response-empty {
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.payload-details {
  margin-top: 1rem;
  border: 1px solid var(--border);
  background: var(--layer-1);
}

.payload-details summary {
  padding: 0.9rem 1rem;
  color: var(--link);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.payload-details[open] summary {
  border-bottom: 1px solid var(--border);
}

.payload-details .code-head {
  padding: 0 1rem;
  margin: 1rem 0 0.65rem;
}

.payload-details pre {
  margin: 0 1rem 1rem;
}

.question {
  border-top: 1px solid var(--border);
  padding-block: 1rem;
}

.question:first-child {
  border-top: 0;
}

.question-title {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}

.question-title .type-label {
  margin: 0;
}

.bars {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) 1fr 3rem;
  gap: 0.65rem;
  align-items: center;
  font-size: 0.75rem;
}

.bar-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 0.55rem;
  background: var(--layer-2);
}

.bar-fill {
  display: block;
  height: 100%;
  width: var(--value);
  background: var(--link);
  transition:
    width 0.2s ease,
    background 0.2s ease;
}

.bar-row.auto .bar-fill {
  background: var(--success);
}

.bar-row.human .bar-fill {
  background: var(--warning);
}

.bar-value {
  text-align: right;
  color: var(--text-muted);
  font: 0.7rem "IBM Plex Mono", monospace;
}

.threshold {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--layer-2);
}

.threshold label {
  font-size: 0.8rem;
  font-weight: 600;
}

input[type="range"] {
  width: min(18rem, 60vw);
  accent-color: var(--primary);
}

output {
  color: var(--link);
  font: 500 0.8rem "IBM Plex Mono", monospace;
}

.verdict {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--success);
  background: var(--layer-2);
  font-size: 0.8rem;
}

.verdict.human {
  border-left-color: var(--warning);
}

.case-grid .panel {
  min-height: 11rem;
  cursor: pointer;
}

.case-grid .panel[aria-current="true"] {
  box-shadow: inset 0 0 0 2px var(--link);
}

.tag {
  color: var(--link);
  font: 0.7rem "IBM Plex Mono", monospace;
  text-transform: uppercase;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

th,
td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

th {
  background: var(--layer-2);
  font-weight: 600;
}

td {
  color: var(--text-muted);
}

td.num,
th.num {
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
}

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

pre {
  overflow-x: auto;
  margin: 0;
  padding: 1.25rem;
  background: var(--code);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  line-height: 1.65;
}

.code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.code-head button {
  border: 1px solid var(--border-strong);
  padding: 0.45rem 0.7rem;
  background: var(--layer-1);
  color: var(--text);
  cursor: pointer;
  font-size: 0.75rem;
}

.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  background: var(--layer-1);
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border-strong);
  border-radius: 0;
  padding: 0.75rem;
  background: var(--layer-2);
  color: var(--text);
}

.field textarea {
  min-height: 5rem;
  resize: vertical;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.consent input {
  margin-top: 0.25rem;
  accent-color: var(--primary);
}

.form-status {
  grid-column: 1 / -1;
  min-height: 1.25rem;
  color: var(--success);
  font-size: 0.8rem;
}

footer {
  padding-block: 2rem;
  border-top: 1px solid var(--border);
  background: var(--layer-1);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.5rem;
}

.notice {
  max-width: 75ch;
  color: var(--text-muted);
  font-size: 0.75rem;
}

@media (max-width: 60rem) {
  .nav {
    flex-wrap: wrap;
    padding-block: 0.5rem;
  }

  .nav-links {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .nav-links a {
    padding-block: 0.4rem;
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 42rem) {
  .container {
    width: min(100% - 2rem, 88rem);
  }

  section {
    padding-block: 3.25rem;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .form {
    grid-template-columns: 1fr;
  }

  .field.full,
  .form-status {
    grid-column: auto;
  }

  .bar-row {
    grid-template-columns: minmax(6rem, 8rem) 1fr 2.5rem;
  }

  .theme button {
    padding-inline: 0.4rem;
  }

  .lang button,
  .lang a {
    padding-inline: 0.5rem;
  }
}

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