:root {
  color-scheme: dark;
  --bg: #12110e;
  --bg-raise: #1c1914;
  --bg-sink: #0c0b09;
  --ink: #f4efe6;
  --muted: #b7aea2;
  --line: #3a342c;
  --copper: #e3944a;
  --copper-ink: #24150b;
  --patina: #8fceb4;
  --rose: #f0a29a;
  --sky: #a9c7e4;
  --violet: #d2b8ea;
  --focus: #f3c48a;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f3eee6;
    --bg-raise: #fffdf8;
    --bg-sink: #e7e0d4;
    --ink: #1d1915;
    --muted: #5e564c;
    --line: #ddd3c4;
    --copper: #b35e16;
    --copper-ink: #fff8f1;
    --patina: #1c7a4e;
    --rose: #a33b32;
    --sky: #1d5c86;
    --violet: #6a4a88;
    --focus: #9a4e0e;
    --shadow: 0 12px 28px rgba(60, 40, 10, 0.08);
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 0% -10%, color-mix(in srgb, var(--copper) 28%, transparent), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

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

.skip {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  background: var(--copper);
  color: var(--copper-ink);
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  z-index: 2;
}

.skip:focus { top: 0.75rem; }

a { color: var(--copper); }

.wrap {
  width: min(1120px, calc(100% - 1.5rem));
  margin: 0 auto;
}

header.site {
  padding: 1.75rem 0 1.25rem;
  border-bottom: 2px solid var(--copper);
}

.brand {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.mark {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: var(--bg-sink);
  color: var(--copper);
  border: 1px solid var(--line);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.95rem;
}

.eyebrow {
  margin: 0;
  color: var(--copper);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
}

h1 {
  margin: 0.1rem 0 0;
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-size: clamp(1.85rem, 4vw, 2.7rem);
  font-weight: 560;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.lede {
  margin: 0.85rem 0 0;
  max-width: 68ch;
  color: var(--muted);
}

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
  padding: 1rem 0 2.5rem;
}

.panel {
  background: color-mix(in srgb, var(--bg-raise) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 0.9rem;
  min-width: 0;
}

.section-head, .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.note {
  margin: 0.75rem 0;
  padding: 0.55rem 0.75rem;
  border-left: 3px solid var(--copper);
  background: color-mix(in srgb, var(--copper) 14%, transparent);
  border-radius: 0 10px 10px 0;
}

textarea {
  display: block;
  width: 100%;
  height: 22rem;
  margin: 0;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-sink);
  color: var(--ink);
  padding: 0.85rem 0.9rem;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
}

#status {
  min-height: 1.4em;
  margin: 0.65rem 0;
  color: var(--muted);
  font-size: 0.92rem;
}

#status[data-tone="bad"] { color: var(--rose); }

.actions, .samples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

button, summary {
  font: inherit;
}

button {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 0.42rem 0.8rem;
  cursor: pointer;
  font-size: 0.875rem;
}

button:hover { border-color: var(--copper); }

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

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

button[aria-pressed="true"] {
  border-color: var(--copper);
  background: color-mix(in srgb, var(--copper) 18%, transparent);
}

button.primary {
  background: var(--copper);
  color: var(--copper-ink);
  border-color: transparent;
  font-weight: 700;
}

button.primary:hover { filter: brightness(1.05); }

.catalog {
  position: sticky;
  top: 0.75rem;
  max-height: calc(100vh - 1.5rem);
  overflow: auto;
}

.count, .warn, .muted, .host, .meta, .tool-name {
  color: var(--muted);
}

.count, .warn { margin: 0.35rem 0 0; font-size: 0.88rem; }

.warn { color: var(--copper); }

.empty {
  margin-top: 0.9rem;
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.empty-title {
  margin: 0 0 0.25rem;
  font-weight: 700;
}

.empty p:last-child { margin: 0; color: var(--muted); }

ol {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.ep {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 12px;
  background: var(--bg-raise);
  overflow: hidden;
}

.m-GET { border-left-color: var(--patina); }
.m-POST { border-left-color: var(--copper); }
.m-PUT, .m-PATCH { border-left-color: var(--sky); }
.m-DELETE { border-left-color: var(--rose); }

.ep-head {
  width: 100%;
  display: grid;
  grid-template-columns: 4.4rem minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
  text-align: left;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0.7rem 0.75rem;
}

.ep-head:hover,
.ep-head[aria-expanded="true"] {
  background: color-mix(in srgb, var(--copper) 10%, transparent);
}

.method {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.m-GET .method { color: var(--patina); }
.m-POST .method { color: var(--copper); }
.m-PUT .method, .m-PATCH .method { color: var(--sky); }
.m-DELETE .method { color: var(--rose); }

.ep-text { display: grid; min-width: 0; }

.path, .schema, pre, .host {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.path {
  overflow-wrap: anywhere;
  font-size: 0.92rem;
}

.host, .meta { font-size: 0.75rem; }

.ep-body {
  padding: 0 0.85rem 0.85rem;
  display: grid;
  gap: 0.7rem;
}

.tool-name { margin: 0; font-size: 0.8rem; }

h3 {
  margin: 0 0 0.3rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

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

th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.2rem 0.4rem 0.2rem 0;
  overflow-wrap: anywhere;
}

th { width: 42%; font-weight: 650; }

.schema, pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--bg-sink);
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
  font-size: 0.8rem;
  max-height: 16rem;
  overflow: auto;
}

details { margin-top: 0.9rem; }

summary { cursor: pointer; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 800px) {
  .wrap { width: min(1120px, calc(100% - 1rem)); }
  header.site { padding-top: 1.2rem; }
  main { grid-template-columns: 1fr; }
  .catalog {
    position: static;
    max-height: none;
    overflow: visible;
  }
  textarea {
    height: 16rem;
    font-size: 16px;
  }
  .ep-head { grid-template-columns: 3.6rem minmax(0, 1fr); }
  .meta { display: none; }
}

@media (max-width: 380px) {
  h1 { font-size: 1.7rem; }
  button { padding: 0.4rem 0.65rem; }
}
