/* hitron docs — hand-written, no framework, no build step. */
:root {
  color-scheme: light dark;
  --bg: #f7f7f5;
  --bg-raise: #ffffff;
  --bg-inset: #eeece7;
  --ink: #16181a;
  --ink-soft: #4b5054;
  --ink-dim: #6d7378;
  --line: #d9d6cf;
  --line-soft: #e6e3dc;
  --accent: #0f6b5c;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1ed;
  --warn: #9a5b00;
  --danger: #a12a20;
  --ok: #1e7a45;
  --code-bg: #15181b;
  --code-ink: #e6e9ea;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
}

html[data-theme="dark"] {
  --bg: #101214;
  --bg-raise: #171a1d;
  --bg-inset: #1d2125;
  --ink: #e9ecee;
  --ink-soft: #b3b9be;
  --ink-dim: #868d93;
  --line: #2b3136;
  --line-soft: #23282c;
  --accent: #4ecdb4;
  --accent-ink: #06201b;
  --accent-soft: #12302a;
  --warn: #e0a44a;
  --danger: #ef8076;
  --ok: #63d492;
  --code-bg: #0a0c0d;
  --code-ink: #dfe4e6;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

code, pre, .mono { font-family: var(--mono); }

.skip {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: .6rem 1rem;
}
.skip:focus { left: 1rem; top: 1rem; }

.dim { color: var(--ink-dim); }
.muted { color: var(--ink-soft); }
.small { font-size: .82rem; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .65rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 650; letter-spacing: -.02em; font-size: 1.05rem;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.brand-mark { color: var(--accent); font-size: .9rem; }
.topnav { display: flex; gap: .2rem; flex: 1; flex-wrap: wrap; }
.topnav a {
  color: var(--ink-soft); text-decoration: none; font-size: .88rem;
  padding: .35rem .6rem; border-radius: 7px;
}
.topnav a:hover { background: var(--bg-inset); color: var(--ink); }
.topbar-actions { display: flex; align-items: center; gap: .6rem; }

.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .74rem; font-weight: 600; letter-spacing: .01em;
  padding: .2rem .55rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-raise);
  white-space: nowrap;
}
.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.pill.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }

.icon-btn {
  border: 1px solid var(--line); background: var(--bg-raise); color: var(--ink);
  width: 2rem; height: 2rem; border-radius: 8px; cursor: pointer;
  font-size: 1rem; line-height: 1;
}
.icon-btn:hover { background: var(--bg-inset); }

/* ---------- layout ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem) 4rem; }
.section { padding: 3.5rem 0 1rem; border-top: 1px solid var(--line-soft); margin-top: 2rem; }
.section:first-of-type { border-top: 0; }
.section-head { max-width: 60rem; margin-bottom: 1.6rem; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -.02em; margin: 0 0 .35rem; }
.section-head p { margin: 0; color: var(--ink-soft); }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 2.5rem;
  padding: 3.5rem 0 1rem; align-items: start;
}
.eyebrow {
  font-size: .78rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 .9rem;
}
.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.05;
  letter-spacing: -.035em; margin: 0 0 1rem; font-weight: 700;
}
.lede { font-size: 1.06rem; color: var(--ink-soft); max-width: 38rem; margin: 0 0 1.6rem; }
.cta-row { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.4rem; }

.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  font: inherit; font-size: .9rem; font-weight: 600;
  padding: .55rem .95rem; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-raise); color: var(--ink);
  text-decoration: none; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--bg-inset); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.cmd {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg-inset); border: 1px solid var(--line);
  border-radius: 9px; padding: .35rem .35rem .35rem .8rem; max-width: 42rem;
}
.cmd code { flex: 1; font-size: .84rem; overflow-x: auto; white-space: nowrap; }
.copy {
  border: 1px solid var(--line); background: var(--bg-raise); color: var(--ink-soft);
  font: inherit; font-size: .76rem; font-weight: 600; padding: .3rem .55rem;
  border-radius: 6px; cursor: pointer; flex-shrink: 0;
}
.copy:hover { color: var(--ink); }

.hero-card {
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem 1.1rem; overflow: hidden;
}
.hero-card-head {
  display: flex; align-items: center; gap: .45rem;
  font-size: .76rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .6rem;
}
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--ink-dim); display: inline-block; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.hero-card pre {
  margin: 0; padding: .85rem; background: var(--code-bg); color: var(--code-ink);
  border-radius: 8px; font-size: .78rem; line-height: 1.55; overflow-x: auto;
}
.hero-card p { margin: .6rem 0 0; }

/* ---------- stats ---------- */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin-top: 2.5rem;
}
.stats > div {
  background: var(--bg-raise); padding: 1rem 1.1rem;
  display: flex; flex-direction: column; gap: .1rem;
}
.stats strong { font-size: 1.5rem; letter-spacing: -.02em; line-height: 1.2; }
.stats span { font-size: .78rem; color: var(--ink-soft); }

/* ---------- steps ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.steps > li {
  display: grid; grid-template-columns: 2.2rem 1fr; gap: 1rem;
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.2rem;
}
.step-num {
  width: 2.2rem; height: 2.2rem; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: .95rem;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.steps h3 { margin: 0 0 .5rem; font-size: 1rem; letter-spacing: -.01em; }
.steps pre { margin: 0 0 .5rem; }
.steps p { margin: 0; font-size: .86rem; }

pre {
  background: var(--code-bg); color: var(--code-ink);
  padding: .8rem .95rem; border-radius: 8px;
  font-size: .8rem; line-height: 1.6; overflow-x: auto;
}
pre code { background: none; padding: 0; color: inherit; }
:not(pre) > code {
  background: var(--bg-inset); border: 1px solid var(--line-soft);
  padding: .08em .35em; border-radius: 5px; font-size: .86em;
}

/* ---------- api console ---------- */
.console-bar {
  display: flex; align-items: flex-end; gap: .8rem; flex-wrap: wrap;
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: .6rem;
}
.console-bar label { display: flex; flex-direction: column; gap: .25rem; font-size: .72rem; font-weight: 600; color: var(--ink-soft); }
.console-bar input {
  font: inherit; font-size: .85rem; padding: .42rem .55rem;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 7px; min-width: 9rem;
}
#base-url { min-width: 16rem; }
#proxy-hint {
  margin: 0 0 1.4rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-raise);
}
#proxy-hint.warn { border-left: 4px solid var(--warn); }
#proxy-hint.ok { border-left: 4px solid var(--ok); }
#proxy-hint code { white-space: normal; overflow-wrap: anywhere; }

.explorer {
  display: grid; grid-template-columns: minmax(15rem, 22rem) 1fr;
  gap: 1rem; align-items: start;
}
.op-sidebar {
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  position: sticky; top: 4.2rem; max-height: calc(100vh - 6rem);
  display: flex; flex-direction: column;
}
.op-search-wrap { display: flex; gap: .4rem; padding: .6rem; border-bottom: 1px solid var(--line-soft); }
.op-search-wrap input, .op-search-wrap select {
  font: inherit; font-size: .82rem; padding: .38rem .5rem;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 7px; min-width: 0;
}
.op-search-wrap input { flex: 1; }
.op-list { overflow-y: auto; padding: .35rem; }
.op-group-label {
  font-size: .7rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-dim); padding: .6rem .55rem .3rem;
}
.op-item {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  text-align: left; font: inherit; font-size: .82rem;
  padding: .38rem .5rem; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink-soft); cursor: pointer;
}
.op-item:hover { background: var(--bg-inset); color: var(--ink); }
.op-item.active { background: var(--accent-soft); color: var(--ink); }
.method {
  font-family: var(--mono); font-size: .64rem; font-weight: 700;
  letter-spacing: .02em; padding: .12rem .32rem; border-radius: 4px;
  min-width: 2.9rem; text-align: center; flex-shrink: 0;
  background: var(--bg-inset); color: var(--ink-soft);
}
.method.get { color: #1c6fd0; background: color-mix(in srgb, #1c6fd0 13%, transparent); }
.method.post { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.method.put { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.method.delete { color: var(--danger); background: color-mix(in srgb, var(--danger) 13%, transparent); }
.op-item .path { font-family: var(--mono); font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.op-detail {
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.2rem 1.3rem; min-height: 26rem;
}
.empty-state { color: var(--ink-soft); text-align: center; padding: 4rem 1rem; }
.empty-state h3 { margin: 0 0 .4rem; color: var(--ink); }

.op-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .4rem; }
.op-head h3 { margin: 0; font-size: 1.1rem; }
.op-summary { color: var(--ink-soft); font-size: .92rem; margin: 0 0 1rem; }
.op-meta { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.op-route {
  display: flex; gap: .5rem; align-items: center;
  background: var(--bg-inset); border: 1px solid var(--line-soft);
  border-radius: 8px; padding: .5rem .6rem; margin-bottom: 1rem;
  font-family: var(--mono); font-size: .8rem; overflow-x: auto;
}

.field-table { width: 100%; border-collapse: collapse; font-size: .82rem; margin-bottom: 1rem; }
.field-table th, .field-table td { text-align: left; padding: .38rem .5rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.field-table th { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-dim); }
.field-table td:first-child { font-family: var(--mono); font-size: .76rem; white-space: nowrap; }
.field-input {
  width: 100%; font: inherit; font-family: var(--mono); font-size: .8rem;
  padding: .35rem .5rem; background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
}
.form-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .8rem; }
.body-editor { margin-top: 1rem; }
.body-editor label { display: block; font-size: .74rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .3rem; }
.body-editor textarea {
  width: 100%; min-height: 8rem; font-family: var(--mono); font-size: .8rem;
  padding: .6rem; background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; resize: vertical;
}
.body-editor .hint { font-size: .74rem; color: var(--ink-dim); margin: .3rem 0 0; }
.schema-tree { font-size: .8rem; }
.schema-tree ul { margin: .2rem 0 .2rem 1.1rem; padding: 0; }
.schema-tree li { margin: .12rem 0; }
.schema-tree .k { font-family: var(--mono); font-size: .76rem; }
.schema-tree .t { color: var(--ink-dim); font-size: .72rem; margin-left: .35rem; }

.response-panel {
  margin-top: 1rem; background: var(--bg-raise);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem;
}
.response-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; flex-wrap: wrap; }
.response-head h3 { margin: 0; font-size: .95rem; }
.response-meta { display: flex; gap: .5rem; align-items: center; }
.code-block {
  margin: 0; max-height: 30rem; overflow: auto;
  background: var(--code-bg); color: var(--code-ink);
  font-size: .78rem; line-height: 1.55;
}

/* ---------- charts ---------- */
.chart-controls { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.chart-controls .inline { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--ink-soft); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1rem; }
.chart-card { background: var(--bg-raise); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.chart-card header { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; margin-bottom: .6rem; }
.chart-card h3 { margin: 0; font-size: .92rem; }
.chart-wrap { position: relative; height: 15rem; }

/* ---------- cards ---------- */
.cards { display: grid; gap: 1rem; }
.cards.three { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.card {
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.15rem 1.25rem;
  display: flex; flex-direction: column;
}
.card h3 { margin: 0 0 .45rem; font-size: 1rem; letter-spacing: -.01em; }
.card p { margin: 0 0 1rem; font-size: .87rem; color: var(--ink-soft); flex: 1; }
.card-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.card.link { text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.card.link:hover { border-color: var(--accent); }
.card.link h3 { color: var(--accent); }

.tutorial {
  margin-top: 1.4rem; background: var(--bg-raise);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 1.1rem 1.3rem;
}
.tutorial h3 { margin: 0 0 .6rem; font-size: .98rem; }
ol.tight { margin: 0; padding-left: 1.2rem; font-size: .88rem; color: var(--ink-soft); }
ol.tight li { margin: .35rem 0; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 0; flex-wrap: wrap; }
.tab {
  font: inherit; font-size: .85rem; font-weight: 600;
  padding: .5rem .9rem; border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-body { background: var(--bg-raise); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 1.1rem 1.2rem; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel pre { margin: 0 0 .6rem; }
.tab-panel p:last-child { margin-bottom: 0; }

/* ---------- logs ---------- */
.log-toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.log-toolbar input {
  font: inherit; font-size: .84rem; padding: .42rem .6rem; flex: 1; min-width: 12rem;
  background: var(--bg-raise); color: var(--ink);
  border: 1px solid var(--line); border-radius: 7px;
}
.log-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.log-card { background: var(--bg-raise); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; min-width: 0; }
.log-card header { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; margin-bottom: .6rem; }
.log-card h3 { margin: 0; font-size: .92rem; }
.table-wrap { overflow: auto; max-height: 22rem; }
table { width: 100%; border-collapse: collapse; font-size: .78rem; }
th, td { text-align: left; padding: .35rem .45rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { position: sticky; top: 0; background: var(--bg-raise); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-dim); }
td:nth-child(2), td:nth-child(4), td:nth-child(5) { font-family: var(--mono); font-size: .74rem; white-space: nowrap; }
tr.status-bad td { color: var(--danger); }

/* ---------- footer / toast ---------- */
.footer { border-top: 1px solid var(--line); padding: 1.6rem clamp(1rem, 4vw, 2.5rem); text-align: center; font-size: .82rem; color: var(--ink-soft); }
.footer p { margin: 0; }
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 2rem);
  background: var(--ink); color: var(--bg); font-size: .84rem; font-weight: 600;
  padding: .55rem 1rem; border-radius: 8px; opacity: 0;
  transition: opacity .2s, transform .2s; pointer-events: none; z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 1.6rem; }
  .explorer { grid-template-columns: 1fr; }
  .op-sidebar { position: static; max-height: 20rem; }
  .log-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topnav { display: none; }
  .cmd code { font-size: .74rem; }
  .steps > li { grid-template-columns: 1fr; }
  .step-num { width: 1.8rem; height: 1.8rem; font-size: .85rem; }
}

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