/* ==========================================================================
   Travelfront API — API documentation
   Plain CSS. No build step. Light + dark via prefers-color-scheme.
   ========================================================================== */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  --bg:          #ffffff;
  --bg-2:        #f6f7f9;
  --surface:     #ffffff;
  --surface-2:   #f2f4f7;
  --surface-3:   #e6e9ee;
  --border:      #dfe3e9;
  --border-soft: #ebeef2;
  --text:        #14171c;
  --muted:       #5d646f;
  --faint:       #868d99;

  --accent:      #2c5fd6;
  --accent-ink:  #ffffff;
  --accent-soft: #e8eefc;

  --ok:          #12703a;
  --ok-soft:     #dcf3e5;
  --warn:        #8a5300;
  --warn-soft:   #fdf1da;
  --err:         #b3261e;
  --err-soft:    #fdeae8;
  --err-line:    #e2a49f;

  --code-bg:     #f7f8fa;
  --j-key:       #8250df;
  --j-str:       #0a6b40;
  --j-num:       #0b4fa8;
  --j-kw:        #b3261e;
  --j-com:       #7a828e;

  --r: 10px;
  --r-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(16, 20, 30, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0e1014;
    --bg-2:        #12151a;
    --surface:     #171a20;
    --surface-2:   #1d2129;
    --surface-3:   #262b34;
    --border:      #2b3039;
    --border-soft: #22262e;
    --text:        #e6e8ed;
    --muted:       #9aa1ae;
    --faint:       #767d8a;

    --accent:      #7ea3ff;
    --accent-ink:  #0e1014;
    --accent-soft: #1b2740;

    --ok:          #56d38a;
    --ok-soft:     #14301f;
    --warn:        #e0b062;
    --warn-soft:   #322510;
    --err:         #ff8078;
    --err-soft:    #391a18;
    --err-line:    #6b2b26;

    --code-bg:     #13161b;
    --j-key:       #c39bff;
    --j-str:       #79d5a4;
    --j-num:       #86b6ff;
    --j-kw:        #ff9a92;
    --j-com:       #6f7783;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

/* The UA's `[hidden] { display: none }` loses to any author `display:` rule, and
   several blocks below are laid out with flex/grid while also being toggled by the
   `hidden` attribute. */
[hidden] { display: none !important; }

html, body { max-width: 100%; overflow-x: hidden; }
html { scroll-behavior: smooth; scroll-padding-top: 74px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

code, kbd, pre, samp { font-family: var(--mono); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* --------------------------------------------------------------- header -- */

.doc-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.doc-header-in {
  max-width: 1320px; margin: 0 auto;
  padding: 10px 20px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 16px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 15px; letter-spacing: -.01em; }
.brand-sub { font-size: 11.5px; color: var(--faint); }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }

.api-chip {
  display: inline-flex; align-items: center; gap: 7px;
  max-width: 46vw;
  padding: 5px 10px;
  font: inherit; font-size: 12.5px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px; cursor: pointer;
}
.api-chip:hover { background: var(--surface-3); }
.api-chip-url { font-family: var(--mono); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot[data-state="ok"]       { background: var(--ok);  box-shadow: 0 0 0 3px var(--ok-soft); }
.dot[data-state="down"]     { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.dot[data-state="checking"] { background: var(--warn); }

.ghost-link {
  font-size: 12.5px; color: var(--muted); text-decoration: none;
  padding: 5px 8px; border-radius: 6px; white-space: nowrap;
}
.ghost-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

.api-editor {
  max-width: 1320px; margin: 0 auto;
  padding: 10px 20px 14px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-2);
}
.api-editor label { font-size: 12.5px; color: var(--muted); }
.api-editor input { flex: 1 1 240px; min-width: 0; }
.api-editor .hint { flex-basis: 100%; margin: 0; }

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

.doc-layout {
  max-width: 1320px; margin: 0 auto;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 28px;
  padding: 0 20px;
  align-items: start;
}

.sidebar {
  position: sticky; top: 62px;
  max-height: calc(100vh - 74px);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 0 40px;
  font-size: 13.5px;
}
.nav-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--faint);
  margin: 16px 0 6px; padding-left: 9px;
}
.nav-title:first-child { margin-top: 0; }
.sidebar a {
  display: flex; align-items: baseline; gap: 7px;
  padding: 4px 9px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
  border-left: 2px solid transparent;
  font-size: 13.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar a.ep { font-family: var(--mono); font-size: 12px; }
.sidebar a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar a.active {
  color: var(--accent); background: var(--accent-soft);
  border-left-color: var(--accent); font-weight: 600;
}
.sidebar .m {
  font-size: 9.5px; font-weight: 700; letter-spacing: .04em;
  padding: 1px 4px; border-radius: 3px; flex: none;
}
.sidebar .m.get  { background: var(--accent-soft); color: var(--accent); }
.sidebar .m.post { background: var(--warn-soft); color: var(--warn); }
.sidebar .m.put  { background: var(--warn-soft); color: var(--warn); }

.doc-main { min-width: 0; padding: 26px 0 60px; }

@media (max-width: 960px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .sidebar {
    position: sticky; top: 53px;
    max-height: none;
    display: flex; gap: 4px;
    overflow-x: auto; overflow-y: hidden;
    padding: 8px 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    z-index: 30;
  }
  .sidebar .nav-title { display: none; }
  .sidebar a { border-left: 0; white-space: nowrap; flex: none; padding: 4px 10px; border-radius: 999px; }
  .sidebar a.active { border-left: 0; }
  .doc-main { padding-top: 18px; }
  html { scroll-padding-top: 108px; }
}

/* ---------------------------------------------------------- typography -- */

h1 { font-size: 30px; line-height: 1.2; letter-spacing: -.022em; margin: 0 0 14px; }
h2 {
  font-size: 21px; line-height: 1.25; letter-spacing: -.015em;
  margin: 44px 0 12px; padding-top: 8px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
section:first-child h2:first-of-type { margin-top: 30px; }
h3 { font-size: 16px; letter-spacing: -.008em; margin: 28px 0 8px; }
h4 { font-size: 14px; margin: 20px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0 0 12px; max-width: 78ch; }
.lede { font-size: 17px; color: var(--muted); max-width: 74ch; }
.hint { font-size: 13px; color: var(--faint); max-width: 78ch; }

section { scroll-margin-top: 76px; border-top: 1px solid var(--border-soft); }
section:first-child { border-top: 0; }
section > h2:first-child { margin-top: 30px; }

:not(pre) > code {
  font-size: .875em;
  background: var(--surface-2);
  padding: 1.5px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-soft);
  overflow-wrap: anywhere;
}

ul.bullets { margin: 0 0 14px; padding-left: 20px; max-width: 78ch; }
ul.bullets li { margin-bottom: 7px; }

.method {
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .05em;
  padding: 3px 8px; border-radius: 5px;
}
.method.get  { background: var(--accent-soft); color: var(--accent); }
.method.post { background: var(--warn-soft); color: var(--warn); }
h2 code.path { font-size: 17px; background: transparent; border: 0; padding: 0; }

/* -------------------------------------------------------------- cards --- */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 20px 0 8px; }
.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
}
.card h3 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.card p { margin: 0 0 4px; font-size: 14px; overflow-wrap: anywhere; }
.card .hint { font-size: 11.5px; margin: 4px 0 0; }

.callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 11px 14px;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  margin: 16px 0;
  font-size: 14px;
  max-width: 80ch;
}
.callout.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------- tables --- */

.tbl-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin: 0 0 16px;
}
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.params { min-width: 640px; }
table.fields { min-width: 520px; }
thead th {
  text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint);
  padding: 8px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-2); }
tbody td:first-child { white-space: nowrap; }
table.fields tbody td:nth-child(2) { color: var(--muted); font-size: 12.5px; }
table.params tbody td:nth-child(2),
table.params tbody td:nth-child(3) { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
table.params tbody td:nth-child(4) { min-width: 260px; }

/* --------------------------------------------------------------- code --- */

.code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin: 0 0 16px;
  overflow: hidden;
}
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 5px 8px 5px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-soft);
  font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--faint);
}
.code pre {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 12.5px;
  line-height: 1.55;
  tab-size: 2;
}
.code pre code { white-space: pre; }

.copy-btn {
  font: inherit; font-family: var(--font);
  font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  flex: none;
}
.copy-btn:hover { background: var(--surface-3); color: var(--text); }

/* JSON highlighting (hand-rolled tokenizer) */
.j-key { color: var(--j-key); }
.j-str { color: var(--j-str); }
.j-num { color: var(--j-num); }
.j-kw  { color: var(--j-kw); font-weight: 600; }
.j-com { color: var(--j-com); font-style: italic; }

/* ------------------------------------------------------------- try it --- */

.tryit { margin: 18px 0 8px; }

.tryit-toggle {
  font: inherit; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
}
.tryit-toggle:hover { filter: brightness(.97); }

.tryit-panel {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
}
.tryit-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  padding: 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.tryit-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tryit-field label { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.tryit-field .t { font-size: 10px; color: var(--faint); }

.tryit-fields.body-only { grid-template-columns: minmax(0, 1fr); }
textarea.body-input { min-height: 190px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }

input[type="text"], input[type="url"], input[type="number"], input[type="password"], select, textarea {
  width: 100%; min-width: 0;
  padding: 6px 8px;
  font: inherit; font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  appearance: none;
}
select { padding-right: 22px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 8px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}

.tryit-actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.tryit-url {
  flex: 1 1 240px; min-width: 0;
  font-family: var(--mono); font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.btn {
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); background: var(--accent); }
.btn-quiet { background: transparent; color: var(--muted); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.tryit-result { padding: 0; }
.tryit-status {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 14px;
  font-size: 12.5px; color: var(--muted);
  border-bottom: 1px solid var(--border-soft);
}
.status-pill {
  font-family: var(--mono); font-size: 11.5px; font-weight: 700;
  padding: 2px 8px; border-radius: 5px;
  background: var(--surface-3); color: var(--text);
}
.status-pill.s2 { background: var(--ok-soft); color: var(--ok); }
.status-pill.s4, .status-pill.s5 { background: var(--err-soft); color: var(--err); }
.status-pill.sx { background: var(--err-soft); color: var(--err); }

.tryit-body-out {
  margin: 0; padding: 12px 14px;
  max-height: 460px; overflow: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 12px; line-height: 1.55;
  background: var(--code-bg);
  white-space: pre;
}
.tryit-error {
  margin: 0; padding: 12px 14px;
  background: var(--err-soft);
  color: var(--err);
  font-size: 13.5px;
  border-top: 1px solid var(--err-line);
}
.tryit-error strong { display: block; margin-bottom: 3px; }
.tryit-error .sub { color: var(--text); font-size: 12.5px; opacity: .85; }

.spin {
  display: inline-block; width: 11px; height: 11px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* --------------------------------------------------- providers (live) --- */

.cap-grid { display: grid; gap: 14px; }
.cap-card {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.cap-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.cap-head h3 { margin: 0; font-size: 15px; font-family: var(--mono); }
.cap-head .tagline { font-size: 12px; color: var(--muted); }
.cap-body { padding: 12px 14px; }
.cap-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cap-pill {
  font-size: 11.5px; font-family: var(--mono);
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted);
}
.cap-pill.yes { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.cap-pill.no  { background: var(--err-soft); color: var(--err); border-color: transparent; }
.cap-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 13px; color: var(--muted); }
.cap-meta b { color: var(--text); font-variant-numeric: tabular-nums; }
.cap-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 0 0 5px; }

.live-err {
  border: 1px solid var(--err-line);
  background: var(--err-soft);
  color: var(--err);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 13.5px;
}
.live-err .sub { color: var(--text); opacity: .85; font-size: 12.5px; margin-top: 4px; }

/* -------------------------------------------------------------- footer -- */

.doc-footer {
  margin-top: 50px; padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--faint);
}

@media (max-width: 420px) {
  body { font-size: 15px; }
  .doc-layout { padding: 0 12px; }
  .doc-header-in { padding: 9px 12px; }
  h1 { font-size: 25px; }
  h2 { font-size: 19px; }
  .tryit-fields { grid-template-columns: minmax(0, 1fr); }
  .api-chip { max-width: 100%; }
}
