/* HourSquare Public API — /docs shell (vault RFC 2026-09-15, decision 11).
   Plain CSS, system fonts, no external resources: the page's CSP allows styles from this origin only
   (plus the style elements the Scalar bundle injects). Scalar's own theme variables drive the reference;
   --scalar-custom-header-height tells its sticky sidebar how tall our top bar is. */

:root {
  --hsq-top-h: 52px;
  --scalar-custom-header-height: var(--hsq-top-h);
  --hsq-side-w: 372px;

  --hsq-bg: #ffffff;
  --hsq-bg-2: #f6f7f9;
  --hsq-bg-3: #eef0f3;
  --hsq-fg: #1b1f24;
  --hsq-fg-2: #5b6470;
  --hsq-border: #dfe3e8;
  --hsq-accent: #1d4ed8;
  --hsq-accent-fg: #ffffff;
  --hsq-ok: #15803d;
  --hsq-ok-bg: #e7f6ec;
  --hsq-warn: #9a3412;
  --hsq-warn-bg: #fff1e6;
  --hsq-live: #b91c1c;
  --hsq-live-bg: #fde8e8;
  --hsq-code-bg: #f1f3f6;
  --hsq-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --hsq-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --hsq-bg: #0f1216;
    --hsq-bg-2: #161a20;
    --hsq-bg-3: #1e232b;
    --hsq-fg: #e6e9ee;
    --hsq-fg-2: #9aa4b2;
    --hsq-border: #2a303a;
    --hsq-accent: #6d9cff;
    --hsq-accent-fg: #0b1220;
    --hsq-ok: #4ade80;
    --hsq-ok-bg: #12331f;
    --hsq-warn: #fdba74;
    --hsq-warn-bg: #3a2410;
    --hsq-live: #fca5a5;
    --hsq-live-bg: #4a1414;
    --hsq-code-bg: #1b2028;
  }
}

/* Follow the Scalar toggle when the visitor overrides the system scheme. */
body.light-mode {
  --hsq-bg: #ffffff; --hsq-bg-2: #f6f7f9; --hsq-bg-3: #eef0f3; --hsq-fg: #1b1f24; --hsq-fg-2: #5b6470;
  --hsq-border: #dfe3e8; --hsq-accent: #1d4ed8; --hsq-accent-fg: #ffffff; --hsq-ok: #15803d; --hsq-ok-bg: #e7f6ec;
  --hsq-warn: #9a3412; --hsq-warn-bg: #fff1e6; --hsq-live: #b91c1c; --hsq-live-bg: #fde8e8; --hsq-code-bg: #f1f3f6;
}
body.dark-mode {
  --hsq-bg: #0f1216; --hsq-bg-2: #161a20; --hsq-bg-3: #1e232b; --hsq-fg: #e6e9ee; --hsq-fg-2: #9aa4b2;
  --hsq-border: #2a303a; --hsq-accent: #6d9cff; --hsq-accent-fg: #0b1220; --hsq-ok: #4ade80; --hsq-ok-bg: #12331f;
  --hsq-warn: #fdba74; --hsq-warn-bg: #3a2410; --hsq-live: #fca5a5; --hsq-live-bg: #4a1414; --hsq-code-bg: #1b2028;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

.hsq-body {
  background: var(--hsq-bg);
  color: var(--hsq-fg);
  font-family: var(--hsq-font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ---- top bar ------------------------------------------------------------------------------ */

.hsq-top {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--hsq-top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: var(--hsq-bg);
  border-bottom: 1px solid var(--hsq-border);
}

body.hsq-live-mode .hsq-top {
  background: var(--hsq-live-bg);
  border-bottom-color: var(--hsq-live);
}

.hsq-brand { font-weight: 600; font-size: 15px; white-space: nowrap; }
.hsq-brand-sub { color: var(--hsq-fg-2); font-weight: 400; }

.hsq-top-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }

.hsq-switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.hsq-switch input { width: 16px; height: 16px; margin: 0; accent-color: var(--hsq-accent); cursor: pointer; }
.hsq-switch-label b { font-weight: 600; }

.hsq-live {
  background: var(--hsq-live);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .02em;
  padding: 3px 8px;
  border-radius: 4px;
}

.hsq-conn {
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--hsq-border);
  background: var(--hsq-bg-2);
  color: var(--hsq-fg-2);
  max-width: 34vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hsq-conn-on { background: var(--hsq-ok-bg); color: var(--hsq-ok); border-color: transparent; }
.hsq-conn-busy { color: var(--hsq-fg); }

.hsq-btn {
  font: inherit;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--hsq-accent);
  background: var(--hsq-accent);
  color: var(--hsq-accent-fg);
  cursor: pointer;
}
.hsq-btn:disabled { opacity: .6; cursor: default; }
.hsq-btn-quiet { background: transparent; color: var(--hsq-fg); border-color: var(--hsq-border); font-weight: 500; }
.hsq-btn-small { padding: 3px 8px; font-size: 12px; }

/* ---- banner --------------------------------------------------------------------------------- */

.hsq-banner {
  position: sticky;
  top: var(--hsq-top-h);
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--hsq-warn-bg);
  color: var(--hsq-warn);
  border-bottom: 1px solid var(--hsq-border);
}
.hsq-banner-ok { background: var(--hsq-ok-bg); color: var(--hsq-ok); }
.hsq-banner-text { flex: 1; }

/* ---- layout --------------------------------------------------------------------------------- */

.hsq-main {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - var(--hsq-top-h));
}

.hsq-side {
  flex: 0 0 var(--hsq-side-w);
  width: var(--hsq-side-w);
  position: sticky;
  top: var(--hsq-top-h);
  max-height: calc(100vh - var(--hsq-top-h));
  overflow-y: auto;
  padding: 16px;
  border-right: 1px solid var(--hsq-border);
  background: var(--hsq-bg-2);
}

body.hsq-side-collapsed .hsq-side { display: none; }

.hsq-reference-wrap { flex: 1 1 auto; min-width: 0; }
.hsq-reference { min-width: 0; }
.hsq-reference-status { padding: 24px; color: var(--hsq-fg-2); }
.hsq-reference-status[hidden] { display: none; }

@media (max-width: 1100px) {
  .hsq-main { flex-direction: column; }
  .hsq-side { position: static; width: auto; flex: none; max-height: none; border-right: 0; border-bottom: 1px solid var(--hsq-border); }
  .hsq-conn { max-width: 50vw; }
}

/* ---- cards & text --------------------------------------------------------------------------- */

.hsq-card {
  background: var(--hsq-bg);
  border: 1px solid var(--hsq-border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.hsq-card[hidden] { display: none; }

.hsq-h2 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
.hsq-h3 { font-size: 13px; font-weight: 600; margin: 18px 0 6px; text-transform: uppercase; letter-spacing: .04em; color: var(--hsq-fg-2); }
.hsq-h3:first-of-type { margin-top: 10px; }

.hsq-card p { margin: 0 0 8px; }
.hsq-muted { color: var(--hsq-fg-2); }
.hsq-small { font-size: 12px; }
.hsq-mono { font-family: var(--hsq-mono); font-size: 12px; word-break: break-all; }

.hsq-list { margin: 0 0 8px; padding-left: 18px; }
.hsq-list li { margin: 2px 0; }
#hsq-me-scopes { list-style: none; padding-left: 0; }
#hsq-me-scopes li { margin: 0 0 4px; }

code {
  font-family: var(--hsq-mono);
  font-size: 12px;
  background: var(--hsq-code-bg);
  border-radius: 3px;
  padding: 1px 4px;
}

.hsq-pre {
  margin: 0 0 8px;
  padding: 10px 12px;
  background: var(--hsq-code-bg);
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.45;
}
.hsq-pre code { background: transparent; padding: 0; font-size: 12px; }

.hsq-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 4px 0 8px; }
.hsq-table th, .hsq-table td { text-align: left; padding: 3px 6px; border-bottom: 1px solid var(--hsq-border); vertical-align: top; }
.hsq-table th { color: var(--hsq-fg-2); font-weight: 600; }

.hsq-dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; column-gap: 12px; row-gap: 6px; }
.hsq-dl dt { color: var(--hsq-fg-2); }
.hsq-dl dd { margin: 0; min-width: 0; }
.hsq-dl-scopes { grid-template-columns: 1fr; row-gap: 2px; }
.hsq-dl-scopes dt { color: var(--hsq-fg); margin-top: 6px; }
.hsq-dl-scopes dd { color: var(--hsq-fg-2); margin-bottom: 4px; }

.hsq-form { display: flex; flex-direction: column; gap: 4px; }
.hsq-label { font-size: 12px; color: var(--hsq-fg-2); margin-top: 6px; }
.hsq-input {
  font: inherit;
  font-family: var(--hsq-mono);
  font-size: 13px;
  padding: 7px 9px;
  border: 1px solid var(--hsq-border);
  border-radius: 6px;
  background: var(--hsq-bg);
  color: var(--hsq-fg);
  width: 100%;
}
.hsq-input:focus { outline: 2px solid var(--hsq-accent); outline-offset: 1px; }
.hsq-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.hsq-form-msg { font-size: 12px; color: var(--hsq-warn); }
.hsq-form-msg.hsq-ok { color: var(--hsq-ok); }

.hsq-expiring { color: var(--hsq-warn); font-weight: 600; }
.hsq-tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 999px; background: var(--hsq-bg-3); color: var(--hsq-fg-2); margin-left: 6px; }

a { color: var(--hsq-accent); }
